All checks were successful
ci / fast (linux) (push) Successful in 6m27s
Implement three missing JS operators that together unblock 57 Test262 full-suite tests (pass rate 42% → 44%): - delete: reference-aware unary operator that removes object properties, with special handling for member/computed/identifier expressions - void: unary operator that evaluates operand and returns undefined - in: binary operator that checks property existence via prototype chain, gated by allow_in flag to disambiguate from for-in loops The allow_in mechanism (with_no_in helper) prevents the parser from consuming `in` as a binary operator inside for-loop initializers, which would break for-in/for-of parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
23 lines
673 B
JavaScript
23 lines
673 B
JavaScript
// delete on an undeclared identifier returns true (sloppy mode)
|
|
var r1 = delete neverDeclared;
|
|
console.log(r1); // true
|
|
|
|
// delete on a declared variable returns false (cannot delete)
|
|
var declared = 42;
|
|
var r2 = delete declared;
|
|
console.log(r2); // false
|
|
|
|
// delete on a call expression (non-reference catch-all) returns true
|
|
// and the call expression is still evaluated for side effects
|
|
var sideEffect = 0;
|
|
function bump() { sideEffect = sideEffect + 1; return 1; }
|
|
var r3 = delete bump();
|
|
console.log(r3); // true
|
|
console.log(sideEffect); // 1
|
|
|
|
// deleting then reassigning a property works
|
|
var obj = {x: 1};
|
|
delete obj.x;
|
|
obj.x = 99;
|
|
console.log(obj.x); // 99
|