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>
26 lines
705 B
JavaScript
26 lines
705 B
JavaScript
// Property whose value is `undefined` still exists — `in` must return true
|
|
var o = {z: undefined};
|
|
console.log("z" in o); // true
|
|
|
|
// Missing property returns false
|
|
console.log("missing" in o); // false
|
|
|
|
// Numeric LHS is coerced to string: 0 in array checks index "0"
|
|
var arr = [10, 20, 30];
|
|
console.log(0 in arr); // true
|
|
console.log(5 in arr); // false
|
|
|
|
// Numeric key in a plain object (set via bracket notation)
|
|
var plain = {};
|
|
plain[2] = "hello";
|
|
console.log(2 in plain); // true
|
|
console.log(3 in plain); // false
|
|
|
|
// Deep prototype chain: `in` must walk all the way up
|
|
function A() {}
|
|
A.prototype.foo = 1;
|
|
function B() {}
|
|
B.prototype = new A();
|
|
var b = new B();
|
|
console.log("foo" in b); // true
|