Bug 1639591 - Part 2: Ship logical assignment operators proposal. r=yulia
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 02 Jun 2020 15:51:36 +0000
changeset 533696 c7e9155860a9873991d57fe7d3e3bb50403f1f25
parent 533695 f15d364b3feca665e6ddc1a0c2d1b53ca68cad04
child 533697 f9735776f715bc7f69b56f773436f9834602bd48
push id117898
push userbtara@mozilla.com
push dateWed, 03 Jun 2020 09:09:50 +0000
treeherderautoland@f9735776f715 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1639591
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1639591 - Part 2: Ship logical assignment operators proposal. r=yulia Depends on D77822 Differential Revision: https://phabricator.services.mozilla.com/D77823
js/src/frontend/TokenStream.cpp
js/src/tests/non262/expressions/short-circuit-compound-assignment-anon-fns.js
js/src/tests/non262/expressions/short-circuit-compound-assignment-const.js
js/src/tests/non262/expressions/short-circuit-compound-assignment-deleted-decl-binding.js
js/src/tests/non262/expressions/short-circuit-compound-assignment-property-key-evaluation.js
js/src/tests/non262/expressions/short-circuit-compound-assignment-scope-lookup.js
js/src/tests/non262/expressions/short-circuit-compound-assignment-tdz.js
js/src/tests/non262/expressions/short-circuit-compound-assignment.js
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -3099,21 +3099,17 @@ MOZ_MUST_USE bool TokenStreamSpecific<Un
         // start of the actually-invalid escape.
         ungetCodeUnit('\\');
         error(JSMSG_BAD_ESCAPE);
         return badToken();
       }
 
       case '|':
         if (matchCodeUnit('|')) {
-#ifdef NIGHTLY_BUILD
           simpleKind = matchCodeUnit('=') ? TokenKind::OrAssign : TokenKind::Or;
-#else
-          simpleKind = TokenKind::Or;
-#endif
 #ifdef ENABLE_PIPELINE_OPERATOR
         } else if (matchCodeUnit('>')) {
           simpleKind = TokenKind::Pipeline;
 #endif
         } else {
           simpleKind =
               matchCodeUnit('=') ? TokenKind::BitOrAssign : TokenKind::BitOr;
         }
@@ -3121,22 +3117,18 @@ MOZ_MUST_USE bool TokenStreamSpecific<Un
 
       case '^':
         simpleKind =
             matchCodeUnit('=') ? TokenKind::BitXorAssign : TokenKind::BitXor;
         break;
 
       case '&':
         if (matchCodeUnit('&')) {
-#ifdef NIGHTLY_BUILD
           simpleKind =
               matchCodeUnit('=') ? TokenKind::AndAssign : TokenKind::And;
-#else
-          simpleKind = TokenKind::And;
-#endif
         } else {
           simpleKind =
               matchCodeUnit('=') ? TokenKind::BitAndAssign : TokenKind::BitAnd;
         }
         break;
 
       case '?':
         if (matchCodeUnit('.')) {
@@ -3148,22 +3140,18 @@ MOZ_MUST_USE bool TokenStreamSpecific<Un
             simpleKind = TokenKind::Hook;
             ungetCodeUnit(unit);
             ungetCodeUnit('.');
           } else {
             ungetCodeUnit(unit);
             simpleKind = TokenKind::OptionalChain;
           }
         } else if (matchCodeUnit('?')) {
-#ifdef NIGHTLY_BUILD
           simpleKind = matchCodeUnit('=') ? TokenKind::CoalesceAssign
                                           : TokenKind::Coalesce;
-#else
-          simpleKind = TokenKind::Coalesce;
-#endif
         } else {
           simpleKind = TokenKind::Hook;
         }
         break;
 
       case '!':
         if (matchCodeUnit('=')) {
           simpleKind = matchCodeUnit('=') ? TokenKind::StrictNe : TokenKind::Ne;
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-anon-fns.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-anon-fns.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // NamedEvaluation applies to short-circuit assignment.
 
 {
   let a;
   a ??= function(){};
   assertEq(a.name, "a");
 }
 
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-const.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-const.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // Test assignment to const and function name bindings. The latter is kind of a
 // const binding, but only throws in strict mode.
 
 function notEvaluated() {
   throw new Error("should not be evaluated");
 }
 
 // AndAssignExpr with const lexical binding.
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-deleted-decl-binding.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-deleted-decl-binding.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // Test when a declarative binding is deleted.
 
 // ES2020, 8.1.1.1.5 SetMutableBinding ( N, V, S )
 //
 // 1. ...
 // 2. If envRec does not have a binding for N, then
 //   a. ...
 //   b. Perform envRec.CreateMutableBinding(N, true).
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-property-key-evaluation.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-property-key-evaluation.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // Test that property keys are only evaluated once.
 
 class PropertyKey {
   constructor(key) {
     this.key = key;
     this.count = 0;
   }
 
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-scope-lookup.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-scope-lookup.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // Test scope lookups are executed in the correct order.
 
 function createScope() {
   let log = [];
   let environment = {};
   let scope = new Proxy(environment, new Proxy({
     has(target, property) {
       log.push({target, property});
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment-tdz.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment-tdz.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 // Test TDZ for short-circutir compound assignments.
 
 // TDZ for lexical |let| bindings.
 {
   assertThrowsInstanceOf(() => { let a = (a &&= 0); }, ReferenceError);
   assertThrowsInstanceOf(() => { let a = (a ||= 0); }, ReferenceError);
   assertThrowsInstanceOf(() => { let a = (a ??= 0); }, ReferenceError);
 }
--- a/js/src/tests/non262/expressions/short-circuit-compound-assignment.js
+++ b/js/src/tests/non262/expressions/short-circuit-compound-assignment.js
@@ -1,10 +1,8 @@
-// |reftest| skip-if(release_or_beta)
-
 const testCasesAnd = [];
 const testCasesOr = [];
 const testCasesCoalesce = [];
 
 
 // Assignment to a global variable (JSOp::SetGName).
 var globalVar;