Title: [260275] trunk
Revision
260275
Author
[email protected]
Date
2020-04-17 12:46:55 -0700 (Fri, 17 Apr 2020)

Log Message

Rename NullishEq / NULLISHEQUAL to CoalesceEq / COALESCEEQUAL to match the spec
https://bugs.webkit.org/show_bug.cgi?id=210663

Reviewed by Ross Kirsling.

JSTests:

* stress/logical-assignment-operator-coalesce.js: Renamed from stress/logical-assignment-operator-nullish.js.

Source/_javascript_Core:

* bytecompiler/NodesCodegen.cpp:
(JSC::emitShortCircuitAssignment):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::makeAssignNode):
* parser/Lexer.cpp:
(JSC::Lexer<T>::lexWithoutClearingLineTerminator):
* parser/Nodes.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAssignmentExpression):
* parser/ParserTokens.h:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/JSTests/ChangeLog (260274 => 260275)


--- trunk/JSTests/ChangeLog	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/JSTests/ChangeLog	2020-04-17 19:46:55 UTC (rev 260275)
@@ -1,5 +1,14 @@
 2020-04-17  Devin Rousso  <[email protected]>
 
+        Rename NullishEq / NULLISHEQUAL to CoalesceEq / COALESCEEQUAL to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=210663
+
+        Reviewed by Ross Kirsling.
+
+        * stress/logical-assignment-operator-coalesce.js: Renamed from stress/logical-assignment-operator-nullish.js.
+
+2020-04-17  Devin Rousso  <[email protected]>
+
         Implement Promise.any and AggregateError
         https://bugs.webkit.org/show_bug.cgi?id=202566
 

Copied: trunk/JSTests/stress/logical-assignment-operator-coalesce.js (from rev 260274, trunk/JSTests/stress/logical-assignment-operator-nullish.js) (0 => 260275)


--- trunk/JSTests/stress/logical-assignment-operator-coalesce.js	                        (rev 0)
+++ trunk/JSTests/stress/logical-assignment-operator-coalesce.js	2020-04-17 19:46:55 UTC (rev 260275)
@@ -0,0 +1,1699 @@
+//@ runLogicalAssignmentOperatorsEnabled
+
+function shouldBe(func, expected) {
+    let actual = func();
+    if (typeof expected === "function" ? !(actual instanceof expected) : actual !== expected)
+        throw new Error(`expected ${JSON.stringify(expected)} but got ${JSON.stringify(actual)}`);
+}
+
+function shouldThrow(func, errorType) {
+    let error;
+    try {
+        func();
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof errorType))
+        throw new Error(`Expected ${errorType.name} but saw ${error && error.name}!`);
+}
+
+function shouldThrowSyntaxError(script) {
+    let error;
+    try {
+        eval(script);
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof SyntaxError))
+        throw new Error(`Expected SyntaxError but saw ${error && error.name}!`);
+}
+
+shouldBe(function() {
+    let x;
+    return x ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x;
+    x ??= 42;
+    return x;
+}, 42);
+
+shouldBe(function() {
+    let x = undefined;
+    return x ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = undefined;
+    x ??= 42;
+    return x;
+}, 42);
+
+shouldBe(function() {
+    let x = null;
+    return x ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = null;
+    x ??= 42;
+    return x;
+}, 42);
+
+shouldBe(function() {
+    let x = true;
+    return x ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = true;
+    x ??= 42;
+    return x;
+}, true);
+
+shouldBe(function() {
+    let x = false;
+    return x ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    x ??= 42;
+    return x;
+}, false);
+
+shouldBe(function() {
+    let x = 0;
+    return x ??= 42;
+}, 0);
+
+shouldBe(function() {
+    let x = 0;
+    x ??= 42;
+    return x;
+}, 0);
+
+shouldBe(function() {
+    let x = 1;
+    return x ??= 42;
+}, 1);
+
+shouldBe(function() {
+    let x = 1;
+    x ??= 42;
+    return x;
+}, 1);
+
+shouldBe(function() {
+    let x = "";
+    return x ??= 42;
+}, "");
+
+shouldBe(function() {
+    let x = "";
+    x ??= 42;
+    return x;
+}, "");
+
+shouldBe(function() {
+    let x = "test";
+    return x ??= 42;
+}, "test");
+
+shouldBe(function() {
+    let x = "test";
+    x ??= 42;
+    return x;
+}, "test");
+
+shouldBe(function() {
+    let x = {};
+    return x ??= 42;
+}, Object);
+
+shouldBe(function() {
+    let x = {};
+    x ??= 42;
+    return x;
+}, Object);
+
+shouldBe(function() {
+    let x = [];
+    return x ??= 42;
+}, Array);
+
+shouldBe(function() {
+    let x = [];
+    x ??= 42;
+    return x;
+}, Array);
+
+
+
+shouldThrow(function() {
+    const x = undefined;
+    return x ??= 42;
+}, TypeError);
+
+shouldThrow(function() {
+    const x = null;
+    return x ??= 42;
+}, TypeError);
+
+shouldBe(function() {
+    const x = true;
+    return x ??= 42;
+}, true);
+
+shouldBe(function() {
+    const x = true;
+    x ??= 42;
+    return x;
+}, true);
+
+shouldBe(function() {
+    const x = false;
+    return x ??= 42;
+}, false);
+
+shouldBe(function() {
+    const x = false;
+    x ??= 42;
+    return x;
+}, false);
+
+shouldBe(function() {
+    const x = 0;
+    return x ??= 42;
+}, 0);
+
+shouldBe(function() {
+    const x = 0;
+    x ??= 42;
+    return x;
+}, 0);
+
+shouldBe(function() {
+    const x = 1;
+    return x ??= 42;
+}, 1);
+
+shouldBe(function() {
+    const x = 1;
+    x ??= 42;
+    return x;
+}, 1);
+
+shouldBe(function() {
+    const x = "";
+    return x ??= 42;
+}, "");
+
+shouldBe(function() {
+    const x = "";
+    x ??= 42;
+    return x;
+}, "");
+
+shouldBe(function() {
+    const x = "test";
+    return x ??= 42;
+}, "test");
+
+shouldBe(function() {
+    const x = "test";
+    return x ??= 42;
+}, "test");
+
+shouldBe(function() {
+    const x = {};
+    return x ??= 42;
+}, Object);
+
+shouldBe(function() {
+    const x = {};
+    return x ??= 42;
+}, Object);
+
+shouldBe(function() {
+    const x = [];
+    return x ??= 42;
+}, Array);
+
+shouldBe(function() {
+    const x = [];
+    return x ??= 42;
+}, Array);
+
+
+
+shouldBe(function() {
+    let x = {};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: undefined};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: undefined};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: null};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: null};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: true};
+    return x.a ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = {a: true};
+    x.a ??= 42;
+    return x.a;
+}, true);
+
+shouldBe(function() {
+    let x = {a: false};
+    return x.a ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = {a: false};
+    x.a ??= 42;
+    return x.a;
+}, false);
+
+shouldBe(function() {
+    let x = {a: 0};
+    return x.a ??= 42;
+}, 0);
+
+shouldBe(function() {
+    let x = {a: 0};
+    x.a ??= 42;
+    return x.a;
+}, 0);
+
+shouldBe(function() {
+    let x = {a: 1};
+    return x.a ??= 42;
+}, 1);
+
+shouldBe(function() {
+    let x = {a: 1};
+    x.a ??= 42;
+    return x.a;
+}, 1);
+
+shouldBe(function() {
+    let x = {a: ""};
+    return x.a ??= 42;
+}, "");
+
+shouldBe(function() {
+    let x = {a: ""};
+    x.a ??= 42;
+    return x.a;
+}, "");
+
+shouldBe(function() {
+    let x = {a: "test"};
+    return x.a ??= 42;
+}, "test");
+
+shouldBe(function() {
+    let x = {a: "test"};
+    x.a ??= 42;
+    return x.a;
+}, "test");
+
+shouldBe(function() {
+    let x = {a: {}};
+    return x.a ??= 42;
+}, Object);
+
+shouldBe(function() {
+    let x = {a: {}};
+    x.a ??= 42;
+    return x.a;
+}, Object);
+
+shouldBe(function() {
+    let x = {a: []};
+    return x.a ??= 42;
+}, Array);
+
+shouldBe(function() {
+    let x = {a: []};
+    x.a ??= 42;
+    return x.a;
+}, Array);
+
+
+
+shouldBe(function() {
+    const x = {};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: undefined};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: undefined};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: null};
+    return x.a ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: null};
+    x.a ??= 42;
+    return x.a;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: true};
+    return x.a ??= 42;
+}, true);
+
+shouldBe(function() {
+    const x = {a: true};
+    x.a ??= 42;
+    return x.a;
+}, true);
+
+shouldBe(function() {
+    const x = {a: false};
+    return x.a ??= 42;
+}, false);
+
+shouldBe(function() {
+    const x = {a: false};
+    x.a ??= 42;
+    return x.a;
+}, false);
+
+shouldBe(function() {
+    const x = {a: 0};
+    return x.a ??= 42;
+}, 0);
+
+shouldBe(function() {
+    const x = {a: 0};
+    x.a ??= 42;
+    return x.a;
+}, 0);
+
+shouldBe(function() {
+    const x = {a: 1};
+    return x.a ??= 42;
+}, 1);
+
+shouldBe(function() {
+    const x = {a: 1};
+    x.a ??= 42;
+    return x.a;
+}, 1);
+
+shouldBe(function() {
+    const x = {a: ""};
+    return x.a ??= 42;
+}, "");
+
+shouldBe(function() {
+    const x = {a: ""};
+    x.a ??= 42;
+    return x.a;
+}, "");
+
+shouldBe(function() {
+    const x = {a: "test"};
+    return x.a ??= 42;
+}, "test");
+
+shouldBe(function() {
+    const x = {a: "test"};
+    x.a ??= 42;
+    return x.a;
+}, "test");
+
+shouldBe(function() {
+    const x = {a: {}};
+    return x.a ??= 42;
+}, Object);
+
+shouldBe(function() {
+    const x = {a: {}};
+    x.a ??= 42;
+    return x.a;
+}, Object);
+
+shouldBe(function() {
+    const x = {a: []};
+    return x.a ??= 42;
+}, Array);
+
+shouldBe(function() {
+    const x = {a: []};
+    x.a ??= 42;
+    return x.a;
+}, Array);
+
+
+
+shouldBe(function() {
+    let x = {};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    let x = {a: undefined};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: undefined};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    let x = {a: null};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = {a: null};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    let x = {a: true};
+    return x["a"] ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = {a: true};
+    x["a"] ??= 42;
+    return x["a"];
+}, true);
+
+shouldBe(function() {
+    let x = {a: false};
+    return x["a"] ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = {a: false};
+    x["a"] ??= 42;
+    return x["a"];
+}, false);
+
+shouldBe(function() {
+    let x = {a: 0};
+    return x["a"] ??= 42;
+}, 0);
+
+shouldBe(function() {
+    let x = {a: 0};
+    x["a"] ??= 42;
+    return x["a"];
+}, 0);
+
+shouldBe(function() {
+    let x = {a: 1};
+    return x["a"] ??= 42;
+}, 1);
+
+shouldBe(function() {
+    let x = {a: 1};
+    x["a"] ??= 42;
+    return x["a"];
+}, 1);
+
+shouldBe(function() {
+    let x = {a: ""};
+    return x["a"] ??= 42;
+}, "");
+
+shouldBe(function() {
+    let x = {a: ""};
+    x["a"] ??= 42;
+    return x["a"];
+}, "");
+
+shouldBe(function() {
+    let x = {a: "test"};
+    return x["a"] ??= 42;
+}, "test");
+
+shouldBe(function() {
+    let x = {a: "test"};
+    x["a"] ??= 42;
+    return x["a"];
+}, "test");
+
+shouldBe(function() {
+    let x = {a: {}};
+    return x["a"] ??= 42;
+}, Object);
+
+shouldBe(function() {
+    let x = {a: {}};
+    x["a"] ??= 42;
+    return x["a"];
+}, Object);
+
+shouldBe(function() {
+    let x = {a: []};
+    return x["a"] ??= 42;
+}, Array);
+
+shouldBe(function() {
+    let x = {a: []};
+    x["a"] ??= 42;
+    return x["a"];
+}, Array);
+
+
+
+shouldBe(function() {
+    const x = {};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    const x = {a: undefined};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: undefined};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    const x = {a: null};
+    return x["a"] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = {a: null};
+    x["a"] ??= 42;
+    return x["a"];
+}, 42);
+
+shouldBe(function() {
+    const x = {a: true};
+    return x["a"] ??= 42;
+}, true);
+
+shouldBe(function() {
+    const x = {a: true};
+    x["a"] ??= 42;
+    return x["a"];
+}, true);
+
+shouldBe(function() {
+    const x = {a: false};
+    return x["a"] ??= 42;
+}, false);
+
+shouldBe(function() {
+    const x = {a: false};
+    x["a"] ??= 42;
+    return x["a"];
+}, false);
+
+shouldBe(function() {
+    const x = {a: 0};
+    return x["a"] ??= 42;
+}, 0);
+
+shouldBe(function() {
+    const x = {a: 0};
+    x["a"] ??= 42;
+    return x["a"];
+}, 0);
+
+shouldBe(function() {
+    const x = {a: 1};
+    return x["a"] ??= 42;
+}, 1);
+
+shouldBe(function() {
+    const x = {a: 1};
+    x["a"] ??= 42;
+    return x["a"];
+}, 1);
+
+shouldBe(function() {
+    const x = {a: ""};
+    return x["a"] ??= 42;
+}, "");
+
+shouldBe(function() {
+    const x = {a: ""};
+    x["a"] ??= 42;
+    return x["a"];
+}, "");
+
+shouldBe(function() {
+    const x = {a: "test"};
+    return x["a"] ??= 42;
+}, "test");
+
+shouldBe(function() {
+    const x = {a: "test"};
+    x["a"] ??= 42;
+    return x["a"];
+}, "test");
+
+shouldBe(function() {
+    const x = {a: {}};
+    return x["a"] ??= 42;
+}, Object);
+
+shouldBe(function() {
+    const x = {a: {}};
+    x["a"] ??= 42;
+    return x["a"];
+}, Object);
+
+shouldBe(function() {
+    const x = {a: []};
+    return x["a"] ??= 42;
+}, Array);
+
+shouldBe(function() {
+    const x = {a: []};
+    x["a"] ??= 42;
+    return x["a"];
+}, Array);
+
+
+
+shouldBe(function() {
+    let x = [];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = [];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    let x = [undefined];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = [undefined];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    let x = [null];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    let x = [null];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    let x = [true];
+    return x[0] ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = [true];
+    x[0] ??= 42;
+    return x[0];
+}, true);
+
+shouldBe(function() {
+    let x = [false];
+    return x[0] ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = [false];
+    x[0] ??= 42;
+    return x[0];
+}, false);
+
+shouldBe(function() {
+    let x = [0];
+    return x[0] ??= 42;
+}, 0);
+
+shouldBe(function() {
+    let x = [0];
+    x[0] ??= 42;
+    return x[0];
+}, 0);
+
+shouldBe(function() {
+    let x = [1];
+    return x[0] ??= 42;
+}, 1);
+
+shouldBe(function() {
+    let x = [1];
+    x[0] ??= 42;
+    return x[0];
+}, 1);
+
+shouldBe(function() {
+    let x = [""];
+    return x[0] ??= 42;
+}, "");
+
+shouldBe(function() {
+    let x = [""];
+    x[0] ??= 42;
+    return x[0];
+}, "");
+
+shouldBe(function() {
+    let x = ["test"];
+    return x[0] ??= 42;
+}, "test");
+
+shouldBe(function() {
+    let x = ["test"];
+    x[0] ??= 42;
+    return x[0];
+}, "test");
+
+shouldBe(function() {
+    let x = [{}];
+    return x[0] ??= 42;
+}, Object);
+
+shouldBe(function() {
+    let x = [{}];
+    x[0] ??= 42;
+    return x[0];
+}, Object);
+
+shouldBe(function() {
+    let x = [[]];
+    return x[0] ??= 42;
+}, Array);
+
+shouldBe(function() {
+    let x = [[]];
+    x[0] ??= 42;
+    return x[0];
+}, Array);
+
+
+
+shouldBe(function() {
+    const x = [];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = [];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    const x = [undefined];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = [undefined];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    const x = [null];
+    return x[0] ??= 42;
+}, 42);
+
+shouldBe(function() {
+    const x = [null];
+    x[0] ??= 42;
+    return x[0];
+}, 42);
+
+shouldBe(function() {
+    const x = [true];
+    return x[0] ??= 42;
+}, true);
+
+shouldBe(function() {
+    const x = [true];
+    x[0] ??= 42;
+    return x[0];
+}, true);
+
+shouldBe(function() {
+    const x = [false];
+    return x[0] ??= 42;
+}, false);
+
+shouldBe(function() {
+    const x = [false];
+    x[0] ??= 42;
+    return x[0];
+}, false);
+
+shouldBe(function() {
+    const x = [0];
+    return x[0] ??= 42;
+}, 0);
+
+shouldBe(function() {
+    const x = [0];
+    x[0] ??= 42;
+    return x[0];
+}, 0);
+
+shouldBe(function() {
+    const x = [1];
+    return x[0] ??= 42;
+}, 1);
+
+shouldBe(function() {
+    const x = [1];
+    x[0] ??= 42;
+    return x[0];
+}, 1);
+
+shouldBe(function() {
+    const x = [""];
+    return x[0] ??= 42;
+}, "");
+
+shouldBe(function() {
+    const x = [""];
+    x[0] ??= 42;
+    return x[0];
+}, "");
+
+shouldBe(function() {
+    const x = ["test"];
+    return x[0] ??= 42;
+}, "test");
+
+shouldBe(function() {
+    const x = ["test"];
+    x[0] ??= 42;
+    return x[0];
+}, "test");
+
+shouldBe(function() {
+    const x = [{}];
+    return x[0] ??= 42;
+}, Object);
+
+shouldBe(function() {
+    const x = [{}];
+    x[0] ??= 42;
+    return x[0];
+}, Object);
+
+shouldBe(function() {
+    const x = [[]];
+    return x[0] ??= 42;
+}, Array);
+
+shouldBe(function() {
+    const x = [[]];
+    x[0] ??= 42;
+    return x[0];
+}, Array);
+
+
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y + z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y = z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y && z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y ?? z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y || z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y &&= z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y ??= z;
+}, false);
+
+shouldBe(function() {
+    let x = false;
+    let y = 1;
+    let z = 2;
+    return x ??= y ||= z;
+}, false);
+
+
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y + z;
+}, 3);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y = z;
+}, 2);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y && z;
+}, 2);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y ?? z;
+}, 1);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y || z;
+}, 1);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y &&= z;
+}, 2);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y ??= z;
+}, 1);
+
+shouldBe(function() {
+    let x = null;
+    let y = 1;
+    let z = 2;
+    return x ??= y ||= z;
+}, 1);
+
+
+
+shouldBe(function() {
+    let log = [];
+
+    let a = true;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get get true");
+
+shouldBe(function() {
+    let log = [];
+
+    let a = false;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get get false");
+
+shouldBe(function() {
+    let log = [];
+
+    let a = undefined;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get set get 42");
+
+
+
+shouldBe(function() {
+    let log = [];
+
+    let a = true;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get get true");
+
+shouldBe(function() {
+    let log = [];
+
+    let a = false;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get get false");
+
+shouldBe(function() {
+    let log = [];
+
+    let a = undefined;
+    let x = {
+        get a() {
+            log.push("get");
+            return a;
+        },
+        set a(v) {
+            log.push("set");
+            a = v;
+        },
+    };
+
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + a;
+}, "get set get 42");
+
+
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super.a;
+        }
+        set a(v) {
+            log.push("set-child");
+            super.a ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = true;
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent get-child get-parent true");
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super.a;
+        }
+        set a(v) {
+            log.push("set-child");
+            super.a ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = false;
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent get-child get-parent false");
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super.a;
+        }
+        set a(v) {
+            log.push("set-child");
+            super.a ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = undefined;
+    x.a ??= 42;
+    x.a ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent set-child get-parent set-parent get-child get-parent 42");
+
+
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super["a"];
+        }
+        set a(v) {
+            log.push("set-child");
+            super["a"] ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = true;
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent get-child get-parent true");
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super["a"];
+        }
+        set a(v) {
+            log.push("set-child");
+            super["a"] ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = false;
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent get-child get-parent false");
+
+shouldBe(function() {
+    let log = [];
+
+    class Parent {
+        get a() {
+            log.push("get-parent");
+            return this._a;
+        }
+        set a(v) {
+            log.push("set-parent");
+            this._a ??= v;
+        }
+    }
+    class Child extends Parent {
+        get a() {
+            log.push("get-child");
+            return super["a"];
+        }
+        set a(v) {
+            log.push("set-child");
+            super["a"] ??= v;
+        }
+    }
+
+    let x = new Child;
+    x._a = undefined;
+    x["a"] ??= 42;
+    x["a"] ??= 42;
+
+    return log.join(" ") + " " + x._a;
+}, "get-child get-parent set-child get-parent set-parent get-child get-parent 42");
+
+
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: true,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: false,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: undefined,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, 42);
+
+
+
+shouldBe(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: true,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, true);
+
+shouldBe(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: false,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, false);
+
+shouldThrow(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: undefined,
+        writable: false,
+    });
+    return x.a ??= 42;
+}, TypeError);
+
+
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: true,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, true);
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: false,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, false);
+
+shouldBe(function() {
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: undefined,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, 42);
+
+
+
+shouldBe(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: true,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, true);
+
+shouldBe(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: false,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, false);
+
+shouldThrow(function() {
+    "use strict";
+    let x = {};
+    Object.defineProperty(x, "a", {
+        value: undefined,
+        writable: false,
+    });
+    return x["a"] ??= 42;
+}, TypeError);
+
+
+
+shouldBe(function() {
+    let x = true;
+    (function() {
+        x ??= 42;
+    })();
+    return x;
+}, true);
+
+shouldBe(function() {
+    let x = false;
+    return (function() {
+        return x ??= 42;
+    })();
+}, false);
+
+shouldBe(function() {
+    let x = undefined;
+    return (function() {
+        return x ??= 42;
+    })();
+}, 42);
+
+
+
+shouldBe(function() {
+    const x = true;
+    (function() {
+        x ??= 42;
+    })();
+    return x;
+}, true);
+
+shouldBe(function() {
+    const x = false;
+    return (function() {
+        return x ??= 42;
+    })();
+}, false);
+
+shouldThrow(function() {
+    const x = undefined;
+    return (function() {
+        return x ??= 42;
+    })();
+}, TypeError);
+
+
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = true;
+    x ??= ++count;
+
+    return count;
+}, 0);
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = false;
+    x ??= ++count;
+
+    return count;
+}, 0);
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = undefined;
+    try {
+        x ??= ++count;
+    } catch { }
+
+    return count;
+}, 1);
+
+
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = true;
+    function capture() { return x; }
+
+    x ??= ++count;
+
+    return count;
+}, 0);
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = false;
+    function capture() { return x; }
+
+    x ??= ++count;
+
+    return count;
+}, 0);
+
+shouldBe(function() {
+    let count = 0;
+
+    const x = undefined;
+    function capture() { return x; }
+
+    try {
+        x ??= ++count;
+    } catch { }
+
+    return count;
+}, 1);
+
+
+
+shouldThrow(function() {
+    x ??= 42;
+    let x = true;
+    return x;
+}, ReferenceError);
+
+
+
+shouldBe(function() {
+    return undefined ??= 42;
+}, 42);
+
+shouldThrowSyntaxError(`null ??= 42`);
+
+shouldThrowSyntaxError(`true ??= 42`);
+
+shouldThrowSyntaxError(`false ??= 42`);
+
+shouldThrowSyntaxError(`0 ??= 42`);
+
+shouldThrowSyntaxError(`1 ??= 42`);
+
+shouldThrowSyntaxError(`"" ??= 42`);
+
+shouldThrowSyntaxError(`"test" ??= 42`);
+
+shouldThrowSyntaxError(`{} ??= 42`);
+
+shouldThrowSyntaxError(`[] ??= 42`);

Deleted: trunk/JSTests/stress/logical-assignment-operator-nullish.js (260274 => 260275)


--- trunk/JSTests/stress/logical-assignment-operator-nullish.js	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/JSTests/stress/logical-assignment-operator-nullish.js	2020-04-17 19:46:55 UTC (rev 260275)
@@ -1,1699 +0,0 @@
-//@ runLogicalAssignmentOperatorsEnabled
-
-function shouldBe(func, expected) {
-    let actual = func();
-    if (typeof expected === "function" ? !(actual instanceof expected) : actual !== expected)
-        throw new Error(`expected ${JSON.stringify(expected)} but got ${JSON.stringify(actual)}`);
-}
-
-function shouldThrow(func, errorType) {
-    let error;
-    try {
-        func();
-    } catch (e) {
-        error = e;
-    }
-
-    if (!(error instanceof errorType))
-        throw new Error(`Expected ${errorType.name} but saw ${error && error.name}!`);
-}
-
-function shouldThrowSyntaxError(script) {
-    let error;
-    try {
-        eval(script);
-    } catch (e) {
-        error = e;
-    }
-
-    if (!(error instanceof SyntaxError))
-        throw new Error(`Expected SyntaxError but saw ${error && error.name}!`);
-}
-
-shouldBe(function() {
-    let x;
-    return x ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x;
-    x ??= 42;
-    return x;
-}, 42);
-
-shouldBe(function() {
-    let x = undefined;
-    return x ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = undefined;
-    x ??= 42;
-    return x;
-}, 42);
-
-shouldBe(function() {
-    let x = null;
-    return x ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = null;
-    x ??= 42;
-    return x;
-}, 42);
-
-shouldBe(function() {
-    let x = true;
-    return x ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = true;
-    x ??= 42;
-    return x;
-}, true);
-
-shouldBe(function() {
-    let x = false;
-    return x ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    x ??= 42;
-    return x;
-}, false);
-
-shouldBe(function() {
-    let x = 0;
-    return x ??= 42;
-}, 0);
-
-shouldBe(function() {
-    let x = 0;
-    x ??= 42;
-    return x;
-}, 0);
-
-shouldBe(function() {
-    let x = 1;
-    return x ??= 42;
-}, 1);
-
-shouldBe(function() {
-    let x = 1;
-    x ??= 42;
-    return x;
-}, 1);
-
-shouldBe(function() {
-    let x = "";
-    return x ??= 42;
-}, "");
-
-shouldBe(function() {
-    let x = "";
-    x ??= 42;
-    return x;
-}, "");
-
-shouldBe(function() {
-    let x = "test";
-    return x ??= 42;
-}, "test");
-
-shouldBe(function() {
-    let x = "test";
-    x ??= 42;
-    return x;
-}, "test");
-
-shouldBe(function() {
-    let x = {};
-    return x ??= 42;
-}, Object);
-
-shouldBe(function() {
-    let x = {};
-    x ??= 42;
-    return x;
-}, Object);
-
-shouldBe(function() {
-    let x = [];
-    return x ??= 42;
-}, Array);
-
-shouldBe(function() {
-    let x = [];
-    x ??= 42;
-    return x;
-}, Array);
-
-
-
-shouldThrow(function() {
-    const x = undefined;
-    return x ??= 42;
-}, TypeError);
-
-shouldThrow(function() {
-    const x = null;
-    return x ??= 42;
-}, TypeError);
-
-shouldBe(function() {
-    const x = true;
-    return x ??= 42;
-}, true);
-
-shouldBe(function() {
-    const x = true;
-    x ??= 42;
-    return x;
-}, true);
-
-shouldBe(function() {
-    const x = false;
-    return x ??= 42;
-}, false);
-
-shouldBe(function() {
-    const x = false;
-    x ??= 42;
-    return x;
-}, false);
-
-shouldBe(function() {
-    const x = 0;
-    return x ??= 42;
-}, 0);
-
-shouldBe(function() {
-    const x = 0;
-    x ??= 42;
-    return x;
-}, 0);
-
-shouldBe(function() {
-    const x = 1;
-    return x ??= 42;
-}, 1);
-
-shouldBe(function() {
-    const x = 1;
-    x ??= 42;
-    return x;
-}, 1);
-
-shouldBe(function() {
-    const x = "";
-    return x ??= 42;
-}, "");
-
-shouldBe(function() {
-    const x = "";
-    x ??= 42;
-    return x;
-}, "");
-
-shouldBe(function() {
-    const x = "test";
-    return x ??= 42;
-}, "test");
-
-shouldBe(function() {
-    const x = "test";
-    return x ??= 42;
-}, "test");
-
-shouldBe(function() {
-    const x = {};
-    return x ??= 42;
-}, Object);
-
-shouldBe(function() {
-    const x = {};
-    return x ??= 42;
-}, Object);
-
-shouldBe(function() {
-    const x = [];
-    return x ??= 42;
-}, Array);
-
-shouldBe(function() {
-    const x = [];
-    return x ??= 42;
-}, Array);
-
-
-
-shouldBe(function() {
-    let x = {};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: undefined};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: undefined};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: null};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: null};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: true};
-    return x.a ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = {a: true};
-    x.a ??= 42;
-    return x.a;
-}, true);
-
-shouldBe(function() {
-    let x = {a: false};
-    return x.a ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = {a: false};
-    x.a ??= 42;
-    return x.a;
-}, false);
-
-shouldBe(function() {
-    let x = {a: 0};
-    return x.a ??= 42;
-}, 0);
-
-shouldBe(function() {
-    let x = {a: 0};
-    x.a ??= 42;
-    return x.a;
-}, 0);
-
-shouldBe(function() {
-    let x = {a: 1};
-    return x.a ??= 42;
-}, 1);
-
-shouldBe(function() {
-    let x = {a: 1};
-    x.a ??= 42;
-    return x.a;
-}, 1);
-
-shouldBe(function() {
-    let x = {a: ""};
-    return x.a ??= 42;
-}, "");
-
-shouldBe(function() {
-    let x = {a: ""};
-    x.a ??= 42;
-    return x.a;
-}, "");
-
-shouldBe(function() {
-    let x = {a: "test"};
-    return x.a ??= 42;
-}, "test");
-
-shouldBe(function() {
-    let x = {a: "test"};
-    x.a ??= 42;
-    return x.a;
-}, "test");
-
-shouldBe(function() {
-    let x = {a: {}};
-    return x.a ??= 42;
-}, Object);
-
-shouldBe(function() {
-    let x = {a: {}};
-    x.a ??= 42;
-    return x.a;
-}, Object);
-
-shouldBe(function() {
-    let x = {a: []};
-    return x.a ??= 42;
-}, Array);
-
-shouldBe(function() {
-    let x = {a: []};
-    x.a ??= 42;
-    return x.a;
-}, Array);
-
-
-
-shouldBe(function() {
-    const x = {};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: undefined};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: undefined};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: null};
-    return x.a ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: null};
-    x.a ??= 42;
-    return x.a;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: true};
-    return x.a ??= 42;
-}, true);
-
-shouldBe(function() {
-    const x = {a: true};
-    x.a ??= 42;
-    return x.a;
-}, true);
-
-shouldBe(function() {
-    const x = {a: false};
-    return x.a ??= 42;
-}, false);
-
-shouldBe(function() {
-    const x = {a: false};
-    x.a ??= 42;
-    return x.a;
-}, false);
-
-shouldBe(function() {
-    const x = {a: 0};
-    return x.a ??= 42;
-}, 0);
-
-shouldBe(function() {
-    const x = {a: 0};
-    x.a ??= 42;
-    return x.a;
-}, 0);
-
-shouldBe(function() {
-    const x = {a: 1};
-    return x.a ??= 42;
-}, 1);
-
-shouldBe(function() {
-    const x = {a: 1};
-    x.a ??= 42;
-    return x.a;
-}, 1);
-
-shouldBe(function() {
-    const x = {a: ""};
-    return x.a ??= 42;
-}, "");
-
-shouldBe(function() {
-    const x = {a: ""};
-    x.a ??= 42;
-    return x.a;
-}, "");
-
-shouldBe(function() {
-    const x = {a: "test"};
-    return x.a ??= 42;
-}, "test");
-
-shouldBe(function() {
-    const x = {a: "test"};
-    x.a ??= 42;
-    return x.a;
-}, "test");
-
-shouldBe(function() {
-    const x = {a: {}};
-    return x.a ??= 42;
-}, Object);
-
-shouldBe(function() {
-    const x = {a: {}};
-    x.a ??= 42;
-    return x.a;
-}, Object);
-
-shouldBe(function() {
-    const x = {a: []};
-    return x.a ??= 42;
-}, Array);
-
-shouldBe(function() {
-    const x = {a: []};
-    x.a ??= 42;
-    return x.a;
-}, Array);
-
-
-
-shouldBe(function() {
-    let x = {};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    let x = {a: undefined};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: undefined};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    let x = {a: null};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = {a: null};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    let x = {a: true};
-    return x["a"] ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = {a: true};
-    x["a"] ??= 42;
-    return x["a"];
-}, true);
-
-shouldBe(function() {
-    let x = {a: false};
-    return x["a"] ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = {a: false};
-    x["a"] ??= 42;
-    return x["a"];
-}, false);
-
-shouldBe(function() {
-    let x = {a: 0};
-    return x["a"] ??= 42;
-}, 0);
-
-shouldBe(function() {
-    let x = {a: 0};
-    x["a"] ??= 42;
-    return x["a"];
-}, 0);
-
-shouldBe(function() {
-    let x = {a: 1};
-    return x["a"] ??= 42;
-}, 1);
-
-shouldBe(function() {
-    let x = {a: 1};
-    x["a"] ??= 42;
-    return x["a"];
-}, 1);
-
-shouldBe(function() {
-    let x = {a: ""};
-    return x["a"] ??= 42;
-}, "");
-
-shouldBe(function() {
-    let x = {a: ""};
-    x["a"] ??= 42;
-    return x["a"];
-}, "");
-
-shouldBe(function() {
-    let x = {a: "test"};
-    return x["a"] ??= 42;
-}, "test");
-
-shouldBe(function() {
-    let x = {a: "test"};
-    x["a"] ??= 42;
-    return x["a"];
-}, "test");
-
-shouldBe(function() {
-    let x = {a: {}};
-    return x["a"] ??= 42;
-}, Object);
-
-shouldBe(function() {
-    let x = {a: {}};
-    x["a"] ??= 42;
-    return x["a"];
-}, Object);
-
-shouldBe(function() {
-    let x = {a: []};
-    return x["a"] ??= 42;
-}, Array);
-
-shouldBe(function() {
-    let x = {a: []};
-    x["a"] ??= 42;
-    return x["a"];
-}, Array);
-
-
-
-shouldBe(function() {
-    const x = {};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    const x = {a: undefined};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: undefined};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    const x = {a: null};
-    return x["a"] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = {a: null};
-    x["a"] ??= 42;
-    return x["a"];
-}, 42);
-
-shouldBe(function() {
-    const x = {a: true};
-    return x["a"] ??= 42;
-}, true);
-
-shouldBe(function() {
-    const x = {a: true};
-    x["a"] ??= 42;
-    return x["a"];
-}, true);
-
-shouldBe(function() {
-    const x = {a: false};
-    return x["a"] ??= 42;
-}, false);
-
-shouldBe(function() {
-    const x = {a: false};
-    x["a"] ??= 42;
-    return x["a"];
-}, false);
-
-shouldBe(function() {
-    const x = {a: 0};
-    return x["a"] ??= 42;
-}, 0);
-
-shouldBe(function() {
-    const x = {a: 0};
-    x["a"] ??= 42;
-    return x["a"];
-}, 0);
-
-shouldBe(function() {
-    const x = {a: 1};
-    return x["a"] ??= 42;
-}, 1);
-
-shouldBe(function() {
-    const x = {a: 1};
-    x["a"] ??= 42;
-    return x["a"];
-}, 1);
-
-shouldBe(function() {
-    const x = {a: ""};
-    return x["a"] ??= 42;
-}, "");
-
-shouldBe(function() {
-    const x = {a: ""};
-    x["a"] ??= 42;
-    return x["a"];
-}, "");
-
-shouldBe(function() {
-    const x = {a: "test"};
-    return x["a"] ??= 42;
-}, "test");
-
-shouldBe(function() {
-    const x = {a: "test"};
-    x["a"] ??= 42;
-    return x["a"];
-}, "test");
-
-shouldBe(function() {
-    const x = {a: {}};
-    return x["a"] ??= 42;
-}, Object);
-
-shouldBe(function() {
-    const x = {a: {}};
-    x["a"] ??= 42;
-    return x["a"];
-}, Object);
-
-shouldBe(function() {
-    const x = {a: []};
-    return x["a"] ??= 42;
-}, Array);
-
-shouldBe(function() {
-    const x = {a: []};
-    x["a"] ??= 42;
-    return x["a"];
-}, Array);
-
-
-
-shouldBe(function() {
-    let x = [];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = [];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    let x = [undefined];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = [undefined];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    let x = [null];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    let x = [null];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    let x = [true];
-    return x[0] ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = [true];
-    x[0] ??= 42;
-    return x[0];
-}, true);
-
-shouldBe(function() {
-    let x = [false];
-    return x[0] ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = [false];
-    x[0] ??= 42;
-    return x[0];
-}, false);
-
-shouldBe(function() {
-    let x = [0];
-    return x[0] ??= 42;
-}, 0);
-
-shouldBe(function() {
-    let x = [0];
-    x[0] ??= 42;
-    return x[0];
-}, 0);
-
-shouldBe(function() {
-    let x = [1];
-    return x[0] ??= 42;
-}, 1);
-
-shouldBe(function() {
-    let x = [1];
-    x[0] ??= 42;
-    return x[0];
-}, 1);
-
-shouldBe(function() {
-    let x = [""];
-    return x[0] ??= 42;
-}, "");
-
-shouldBe(function() {
-    let x = [""];
-    x[0] ??= 42;
-    return x[0];
-}, "");
-
-shouldBe(function() {
-    let x = ["test"];
-    return x[0] ??= 42;
-}, "test");
-
-shouldBe(function() {
-    let x = ["test"];
-    x[0] ??= 42;
-    return x[0];
-}, "test");
-
-shouldBe(function() {
-    let x = [{}];
-    return x[0] ??= 42;
-}, Object);
-
-shouldBe(function() {
-    let x = [{}];
-    x[0] ??= 42;
-    return x[0];
-}, Object);
-
-shouldBe(function() {
-    let x = [[]];
-    return x[0] ??= 42;
-}, Array);
-
-shouldBe(function() {
-    let x = [[]];
-    x[0] ??= 42;
-    return x[0];
-}, Array);
-
-
-
-shouldBe(function() {
-    const x = [];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = [];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    const x = [undefined];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = [undefined];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    const x = [null];
-    return x[0] ??= 42;
-}, 42);
-
-shouldBe(function() {
-    const x = [null];
-    x[0] ??= 42;
-    return x[0];
-}, 42);
-
-shouldBe(function() {
-    const x = [true];
-    return x[0] ??= 42;
-}, true);
-
-shouldBe(function() {
-    const x = [true];
-    x[0] ??= 42;
-    return x[0];
-}, true);
-
-shouldBe(function() {
-    const x = [false];
-    return x[0] ??= 42;
-}, false);
-
-shouldBe(function() {
-    const x = [false];
-    x[0] ??= 42;
-    return x[0];
-}, false);
-
-shouldBe(function() {
-    const x = [0];
-    return x[0] ??= 42;
-}, 0);
-
-shouldBe(function() {
-    const x = [0];
-    x[0] ??= 42;
-    return x[0];
-}, 0);
-
-shouldBe(function() {
-    const x = [1];
-    return x[0] ??= 42;
-}, 1);
-
-shouldBe(function() {
-    const x = [1];
-    x[0] ??= 42;
-    return x[0];
-}, 1);
-
-shouldBe(function() {
-    const x = [""];
-    return x[0] ??= 42;
-}, "");
-
-shouldBe(function() {
-    const x = [""];
-    x[0] ??= 42;
-    return x[0];
-}, "");
-
-shouldBe(function() {
-    const x = ["test"];
-    return x[0] ??= 42;
-}, "test");
-
-shouldBe(function() {
-    const x = ["test"];
-    x[0] ??= 42;
-    return x[0];
-}, "test");
-
-shouldBe(function() {
-    const x = [{}];
-    return x[0] ??= 42;
-}, Object);
-
-shouldBe(function() {
-    const x = [{}];
-    x[0] ??= 42;
-    return x[0];
-}, Object);
-
-shouldBe(function() {
-    const x = [[]];
-    return x[0] ??= 42;
-}, Array);
-
-shouldBe(function() {
-    const x = [[]];
-    x[0] ??= 42;
-    return x[0];
-}, Array);
-
-
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y + z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y = z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y && z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y ?? z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y || z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y &&= z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y ??= z;
-}, false);
-
-shouldBe(function() {
-    let x = false;
-    let y = 1;
-    let z = 2;
-    return x ??= y ||= z;
-}, false);
-
-
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y + z;
-}, 3);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y = z;
-}, 2);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y && z;
-}, 2);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y ?? z;
-}, 1);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y || z;
-}, 1);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y &&= z;
-}, 2);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y ??= z;
-}, 1);
-
-shouldBe(function() {
-    let x = null;
-    let y = 1;
-    let z = 2;
-    return x ??= y ||= z;
-}, 1);
-
-
-
-shouldBe(function() {
-    let log = [];
-
-    let a = true;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get get true");
-
-shouldBe(function() {
-    let log = [];
-
-    let a = false;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get get false");
-
-shouldBe(function() {
-    let log = [];
-
-    let a = undefined;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get set get 42");
-
-
-
-shouldBe(function() {
-    let log = [];
-
-    let a = true;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get get true");
-
-shouldBe(function() {
-    let log = [];
-
-    let a = false;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get get false");
-
-shouldBe(function() {
-    let log = [];
-
-    let a = undefined;
-    let x = {
-        get a() {
-            log.push("get");
-            return a;
-        },
-        set a(v) {
-            log.push("set");
-            a = v;
-        },
-    };
-
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + a;
-}, "get set get 42");
-
-
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super.a;
-        }
-        set a(v) {
-            log.push("set-child");
-            super.a ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = true;
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent get-child get-parent true");
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super.a;
-        }
-        set a(v) {
-            log.push("set-child");
-            super.a ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = false;
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent get-child get-parent false");
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super.a;
-        }
-        set a(v) {
-            log.push("set-child");
-            super.a ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = undefined;
-    x.a ??= 42;
-    x.a ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent set-child get-parent set-parent get-child get-parent 42");
-
-
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super["a"];
-        }
-        set a(v) {
-            log.push("set-child");
-            super["a"] ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = true;
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent get-child get-parent true");
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super["a"];
-        }
-        set a(v) {
-            log.push("set-child");
-            super["a"] ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = false;
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent get-child get-parent false");
-
-shouldBe(function() {
-    let log = [];
-
-    class Parent {
-        get a() {
-            log.push("get-parent");
-            return this._a;
-        }
-        set a(v) {
-            log.push("set-parent");
-            this._a ??= v;
-        }
-    }
-    class Child extends Parent {
-        get a() {
-            log.push("get-child");
-            return super["a"];
-        }
-        set a(v) {
-            log.push("set-child");
-            super["a"] ??= v;
-        }
-    }
-
-    let x = new Child;
-    x._a = undefined;
-    x["a"] ??= 42;
-    x["a"] ??= 42;
-
-    return log.join(" ") + " " + x._a;
-}, "get-child get-parent set-child get-parent set-parent get-child get-parent 42");
-
-
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: true,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: false,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: undefined,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, 42);
-
-
-
-shouldBe(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: true,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, true);
-
-shouldBe(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: false,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, false);
-
-shouldThrow(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: undefined,
-        writable: false,
-    });
-    return x.a ??= 42;
-}, TypeError);
-
-
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: true,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, true);
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: false,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, false);
-
-shouldBe(function() {
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: undefined,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, 42);
-
-
-
-shouldBe(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: true,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, true);
-
-shouldBe(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: false,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, false);
-
-shouldThrow(function() {
-    "use strict";
-    let x = {};
-    Object.defineProperty(x, "a", {
-        value: undefined,
-        writable: false,
-    });
-    return x["a"] ??= 42;
-}, TypeError);
-
-
-
-shouldBe(function() {
-    let x = true;
-    (function() {
-        x ??= 42;
-    })();
-    return x;
-}, true);
-
-shouldBe(function() {
-    let x = false;
-    return (function() {
-        return x ??= 42;
-    })();
-}, false);
-
-shouldBe(function() {
-    let x = undefined;
-    return (function() {
-        return x ??= 42;
-    })();
-}, 42);
-
-
-
-shouldBe(function() {
-    const x = true;
-    (function() {
-        x ??= 42;
-    })();
-    return x;
-}, true);
-
-shouldBe(function() {
-    const x = false;
-    return (function() {
-        return x ??= 42;
-    })();
-}, false);
-
-shouldThrow(function() {
-    const x = undefined;
-    return (function() {
-        return x ??= 42;
-    })();
-}, TypeError);
-
-
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = true;
-    x ??= ++count;
-
-    return count;
-}, 0);
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = false;
-    x ??= ++count;
-
-    return count;
-}, 0);
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = undefined;
-    try {
-        x ??= ++count;
-    } catch { }
-
-    return count;
-}, 1);
-
-
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = true;
-    function capture() { return x; }
-
-    x ??= ++count;
-
-    return count;
-}, 0);
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = false;
-    function capture() { return x; }
-
-    x ??= ++count;
-
-    return count;
-}, 0);
-
-shouldBe(function() {
-    let count = 0;
-
-    const x = undefined;
-    function capture() { return x; }
-
-    try {
-        x ??= ++count;
-    } catch { }
-
-    return count;
-}, 1);
-
-
-
-shouldThrow(function() {
-    x ??= 42;
-    let x = true;
-    return x;
-}, ReferenceError);
-
-
-
-shouldBe(function() {
-    return undefined ??= 42;
-}, 42);
-
-shouldThrowSyntaxError(`null ??= 42`);
-
-shouldThrowSyntaxError(`true ??= 42`);
-
-shouldThrowSyntaxError(`false ??= 42`);
-
-shouldThrowSyntaxError(`0 ??= 42`);
-
-shouldThrowSyntaxError(`1 ??= 42`);
-
-shouldThrowSyntaxError(`"" ??= 42`);
-
-shouldThrowSyntaxError(`"test" ??= 42`);
-
-shouldThrowSyntaxError(`{} ??= 42`);
-
-shouldThrowSyntaxError(`[] ??= 42`);

Modified: trunk/Source/_javascript_Core/ChangeLog (260274 => 260275)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-17 19:46:55 UTC (rev 260275)
@@ -1,5 +1,23 @@
 2020-04-17  Devin Rousso  <[email protected]>
 
+        Rename NullishEq / NULLISHEQUAL to CoalesceEq / COALESCEEQUAL to match the spec
+        https://bugs.webkit.org/show_bug.cgi?id=210663
+
+        Reviewed by Ross Kirsling.
+
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::emitShortCircuitAssignment):
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::makeAssignNode):
+        * parser/Lexer.cpp:
+        (JSC::Lexer<T>::lexWithoutClearingLineTerminator):
+        * parser/Nodes.h:
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseAssignmentExpression):
+        * parser/ParserTokens.h:
+
+2020-04-17  Devin Rousso  <[email protected]>
+
         Implement Promise.any and AggregateError
         https://bugs.webkit.org/show_bug.cgi?id=202566
 

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (260274 => 260275)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-04-17 19:46:55 UTC (rev 260275)
@@ -2951,7 +2951,7 @@
 static ALWAYS_INLINE void emitShortCircuitAssignment(BytecodeGenerator& generator, RegisterID* value, Operator oper, Label& afterAssignment)
 {
     switch (oper) {
-    case Operator::NullishEq:
+    case Operator::CoalesceEq:
         generator.emitJumpIfFalse(generator.emitIsUndefinedOrNull(generator.newTemporary(), value), afterAssignment);
         break;
 

Modified: trunk/Source/_javascript_Core/parser/ASTBuilder.h (260274 => 260275)


--- trunk/Source/_javascript_Core/parser/ASTBuilder.h	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/parser/ASTBuilder.h	2020-04-17 19:46:55 UTC (rev 260275)
@@ -1560,7 +1560,7 @@
             return node;
         }
 
-        if (op == Operator::NullishEq || op == Operator::OrEq || op == Operator::AndEq)
+        if (op == Operator::CoalesceEq || op == Operator::OrEq || op == Operator::AndEq)
             return new (m_parserArena) ShortCircuitReadModifyResolveNode(location, resolve->identifier(), op, expr, exprHasAssignments, divot, start, end);
 
         return new (m_parserArena) ReadModifyResolveNode(location, resolve->identifier(), op, expr, exprHasAssignments, divot, start, end);
@@ -1572,7 +1572,7 @@
         if (op == Operator::Equal)
             return new (m_parserArena) AssignBracketNode(location, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), start, end);
 
-        if (op == Operator::NullishEq || op == Operator::OrEq || op == Operator::AndEq) {
+        if (op == Operator::CoalesceEq || op == Operator::OrEq || op == Operator::AndEq) {
             auto* node = new (m_parserArena) ShortCircuitReadModifyBracketNode(location, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, start, end);
             node->setSubexpressionInfo(bracket->divot(), bracket->divotEnd().offset);
             return node;
@@ -1589,7 +1589,7 @@
     if (op == Operator::Equal)
         return new (m_parserArena) AssignDotNode(location, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), start, end);
 
-    if (op == Operator::NullishEq || op == Operator::OrEq || op == Operator::AndEq) {
+    if (op == Operator::CoalesceEq || op == Operator::OrEq || op == Operator::AndEq) {
         auto* node = new (m_parserArena) ShortCircuitReadModifyDotNode(location, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, start, end);
         node->setSubexpressionInfo(dot->divot(), dot->divotEnd().offset);
         return node;

Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (260274 => 260275)


--- trunk/Source/_javascript_Core/parser/Lexer.cpp	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp	2020-04-17 19:46:55 UTC (rev 260275)
@@ -2171,7 +2171,7 @@
             shift();
             if (UNLIKELY(Options::useLogicalAssignmentOperators() && m_current == '=')) {
                 shift();
-                token = NULLISHEQUAL;
+                token = COALESCEEQUAL;
                 break;
             }
             token = COALESCE;

Modified: trunk/Source/_javascript_Core/parser/Nodes.h (260274 => 260275)


--- trunk/Source/_javascript_Core/parser/Nodes.h	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/parser/Nodes.h	2020-04-17 19:46:55 UTC (rev 260275)
@@ -68,7 +68,7 @@
         BitOrEq,
         ModEq,
         PowEq,
-        NullishEq,
+        CoalesceEq,
         OrEq,
         AndEq,
         LShift,

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (260274 => 260275)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2020-04-17 19:46:55 UTC (rev 260275)
@@ -3871,7 +3871,7 @@
         case BITOREQUAL: op = Operator::BitOrEq; break;
         case MODEQUAL: op = Operator::ModEq; break;
         case POWEQUAL: op = Operator::PowEq; break;
-        case NULLISHEQUAL: op = Operator::NullishEq; break;
+        case COALESCEEQUAL: op = Operator::CoalesceEq; break;
         case OREQUAL: op = Operator::OrEq; break;
         case ANDEQUAL: op = Operator::AndEq; break;
         default:

Modified: trunk/Source/_javascript_Core/parser/ParserTokens.h (260274 => 260275)


--- trunk/Source/_javascript_Core/parser/ParserTokens.h	2020-04-17 19:32:41 UTC (rev 260274)
+++ trunk/Source/_javascript_Core/parser/ParserTokens.h	2020-04-17 19:46:55 UTC (rev 260275)
@@ -134,7 +134,7 @@
     BITANDEQUAL,
     BITXOREQUAL,
     BITOREQUAL,
-    NULLISHEQUAL,
+    COALESCEEQUAL,
     OREQUAL,
     ANDEQUAL,
     DOTDOTDOT,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to