コード例 #1
0
 protected Object computeAssign(Environment env, Object rvalue) {
   ASTree l = left();
   if (l instanceof Name) {
     env.put(((Name) l).name(), rvalue);
     return rvalue;
   } else throw new StoneException("bad assignment", this);
 }
コード例 #2
0
 public Object eval(Environment env) {
   Object value = env.get(name());
   if (value == null) throw new StoneException("undefined name: " + name(), this);
   else return value;
 }