/** * Evaluates as an array index assign ($a[index] = &value). */ public override Value evalArrayAssignRef(Env env, Expr indexExpr, Expr valueExpr) { Value obj = env.getThis(); StringValue name = evalName(env); Value fieldVar = obj.getThisFieldArray(env, name); Value index = indexExpr.eval(env); Value value = valueExpr.evalRef(env); // php/03mn return(fieldVar.putThisFieldArray(env, obj, name, index, value)); }
/** * Evaluates as an array index assign ($a[index] = value). * @return what was assigned */ public Value evalArrayAssignRef(Env env, Expr indexExpr, Expr valueExpr) { // php/03mk, php/03mm, php/03mn, php/04b3 // overrided in ThisFieldExpr and ThisFieldVarExpr //Value var = eval(env); // //return var.put(index, value); Value array = evalArray(env); Value index = indexExpr.eval(env); Value value = valueExpr.evalRef(env); Value result = array.put(index, value); //return array.get(index); // php/03mm php/03mn return(result); }
/** * Evaluates as an array index assign ($a[index] = value). */ public override Value evalArrayAssignRef(Env env, Expr indexExpr, Expr valueExpr) { init(); Value obj = env.getThis(); if (obj.isNull()) { return(env.thisError(getLocation())); } // php/044i Value fieldVar = obj.getThisFieldArray(env, _name); Value index = indexExpr.eval(env); Value value = valueExpr.evalRef(env); return(fieldVar.putThisFieldArray(env, obj, _name, index, value)); }
/** * Evaluates an assignment. If the value @is a Var, it replaces the * current Var. */ public Value evalAssignRef(Env env, Expr valueExpr) { Value value = valueExpr.evalRef(env); return(evalAssignRef(env, value)); }