11.8.7 in operator

2010-05-17

RelationalExpression : RelationalExpression in ShiftExpression

Code: (Meta Ecma)
function evaluate(RelationalExpression in ShiftExpression) {
var lref = evaluate(RelationalExpression);
var lval = GetValue(lref);
var rref = evaluate(ShiftExpression);
var rval = GetValue(rref);
if (Type(rval) != 'object') throw TypeError;
return rval.[[HasProperty]](ToString(lval));
}

Note that the left operand is converted to String before checking whether it exists.

This operator is the cause of a lot of duplicate Productions. Very annoying. But it was required to make the distinction with the for statement.