mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 17:05:06 +00:00

Unary expressions parsing now respects precedence and associativity of operators. This patch also makes `typeof` left-associative which was an oversight. Thanks to Conrad for helping me work this out. :^)
18 lines
358 B
JavaScript
18 lines
358 B
JavaScript
function assert(x) { if (!x) throw 1; }
|
|
|
|
try {
|
|
var o = {};
|
|
o.a = 1;
|
|
|
|
assert(o.a === 1);
|
|
assert(!o.a === false);
|
|
assert(!o.a === !(o.a));
|
|
assert(~o.a === ~(o.a));
|
|
|
|
assert((typeof "x" === "string") === true);
|
|
assert(!(typeof "x" === "string") === false);
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|