1 29 30 package com.caucho.quercus.expr; 31 32 import com.caucho.quercus.Location; 33 import com.caucho.quercus.env.Env; 34 import com.caucho.quercus.env.Value; 35 36 39 public class AddExpr extends BinaryExpr { 40 protected AddExpr(Location location, Expr left, Expr right) 41 { 42 super(location, left, right); 43 } 44 45 protected AddExpr(Expr left, Expr right) 46 { 47 super(left, right); 48 } 49 50 public Value eval(Env env) 51 { 52 Value lValue = _left.eval(env); 53 Value rValue = _right.eval(env); 54 55 return lValue.add(rValue); 56 } 57 58 61 public boolean isDouble() 62 { 63 return _left.isDouble() || _right.isDouble(); 64 } 65 66 69 public boolean isLong() 70 { 71 return _left.isLong() && _right.isLong(); 72 } 73 74 77 public boolean isNumber() 78 { 79 return true; 80 } 81 82 public String toString() 83 { 84 return "(" + _left + " + " + _right + ")"; 85 } 86 } 87 88 | Popular Tags |