Rename NullishEq / NULLISHEQUAL to CoalesceEq / COALESCEEQUAL to match the spec
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Apr 2020 19:46:55 +0000 (19:46 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Apr 2020 19:46:55 +0000 (19:46 +0000)
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/JavaScriptCore:

* 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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@260275 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/stress/logical-assignment-operator-coalesce.js [moved from JSTests/stress/logical-assignment-operator-nullish.js with 100% similarity]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/parser/ASTBuilder.h
Source/JavaScriptCore/parser/Lexer.cpp
Source/JavaScriptCore/parser/Nodes.h
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/ParserTokens.h

index f216d7c..b9bfdb8 100644 (file)
@@ -1,5 +1,14 @@
 2020-04-17  Devin Rousso  <drousso@apple.com>
 
+        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  <drousso@apple.com>
+
         Implement Promise.any and AggregateError
         https://bugs.webkit.org/show_bug.cgi?id=202566
 
index 287b3bb..4397dd4 100644 (file)
@@ -1,5 +1,23 @@
 2020-04-17  Devin Rousso  <drousso@apple.com>
 
+        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  <drousso@apple.com>
+
         Implement Promise.any and AggregateError
         https://bugs.webkit.org/show_bug.cgi?id=202566
 
index 07f008b..01e569b 100644 (file)
@@ -2951,7 +2951,7 @@ RegisterID* ReadModifyResolveNode::emitBytecode(BytecodeGenerator& generator, Re
 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;
 
index 5e353bd..d955808 100644 (file)
@@ -1560,7 +1560,7 @@ ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, Expr
             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 @@ ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, Expr
         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 @@ ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, Expr
     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;
index bae5f6f..9aa2673 100644 (file)
@@ -2171,7 +2171,7 @@ start:
             shift();
             if (UNLIKELY(Options::useLogicalAssignmentOperators() && m_current == '=')) {
                 shift();
-                token = NULLISHEQUAL;
+                token = COALESCEEQUAL;
                 break;
             }
             token = COALESCE;
index b515604..c2974ea 100644 (file)
@@ -68,7 +68,7 @@ namespace JSC {
         BitOrEq,
         ModEq,
         PowEq,
-        NullishEq,
+        CoalesceEq,
         OrEq,
         AndEq,
         LShift,
index 976757b..a39719e 100644 (file)
@@ -3871,7 +3871,7 @@ template <typename TreeBuilder> TreeExpression Parser<LexerType>::parseAssignmen
         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:
index d1c47ef..de0ebea 100644 (file)
@@ -134,7 +134,7 @@ enum JSTokenType {
     BITANDEQUAL,
     BITXOREQUAL,
     BITOREQUAL,
-    NULLISHEQUAL,
+    COALESCEEQUAL,
     OREQUAL,
     ANDEQUAL,
     DOTDOTDOT,