function evaluate(LefthandSideExpression = AssignmentExpression) {
var lref = evaluate(LefthandSideExpression);
var rref = evaluate(AssignmentExpression);
var rval = GetValue(rref);
if (Type(rval) == 'reference' && IsStrictReference(lref) && Type(GetBase(lref)) == 'environmentRecord' && (GetReferencedName(lref) == 'eval' || GetReferencedName(lref) == 'arguments')) {
throw SyntaxError;
}
PutValue(lref, rval);
return rval;
}
Note that the left hand side must not evaluate to an unresolvable reference. If it does, a ReferenceError is thrown on assignment (by PutValue). It may also not be a reference to a data property with [[Writable]] equal to false, or an accessor with [[Set]] equal to undefined, or to a non-existant property of an object whose [[Extensible]] set to false. In all these cases a TypeError is thrown (again, by or through PutValue).