Bug 1500836 - Call setBindingsAccessedDynamically if delete with name operand appears in BinAST. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Tue, 08 Jan 2019 11:33:21 +0900
changeset 509962 a9f1fba8641a368ffdbea3b7daf62c3a1a6a4152
parent 509961 ee32392ef5b3ce7e5f72cf052458a2dd139be386
child 509963 176cd5a3fa572d26b1db71c50b49cb867712c290
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1500836
milestone66.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 1500836 - Call setBindingsAccessedDynamically if delete with name operand appears in BinAST. r=Yoric
js/src/frontend/BinASTParser.cpp
js/src/frontend/BinSource.yaml
--- a/js/src/frontend/BinASTParser.cpp
+++ b/js/src/frontend/BinASTParser.cpp
@@ -4114,16 +4114,18 @@ JS::Result<ParseNode*> BinASTParser<Tok>
     case UnaryOperator::Void:
       pnk = ParseNodeKind::VoidExpr;
       break;
     case UnaryOperator::Delete: {
       switch (operand->getKind()) {
         case ParseNodeKind::Name:
           operand->setOp(JSOP_DELNAME);
           pnk = ParseNodeKind::DeleteNameExpr;
+          BINJS_TRY(this->strictModeError(JSMSG_DEPRECATED_DELETE_OPERAND));
+          parseContext_->sc()->setBindingsAccessedDynamically();
           break;
         case ParseNodeKind::DotExpr:
           pnk = ParseNodeKind::DeletePropExpr;
           break;
         case ParseNodeKind::ElemExpr:
           pnk = ParseNodeKind::DeleteElemExpr;
           break;
         default:
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -342,17 +342,17 @@ hpp:
 
             } // namespace frontend
             } // namespace js
 
             #endif // frontend_BinToken_h
 
 Arguments:
     init:
-        BINJS_TRY_DECL(result, factory_.newList(ParseNodeKind::ArgumentsExpr, tokenizer_->pos(start)));
+        BINJS_TRY_DECL(result, factory_.newList(ParseNodeKind::Arguments, tokenizer_->pos(start)));
     append:
         factory_.addList(/* list = */ result, /* kid = */ item);
 
 ArrayExpression:
     build: |
         if (elements->empty()) {
             elements->setHasNonConstInitializer();
         }
@@ -763,17 +763,17 @@ ContinueStatement:
 DataProperty:
     build: |
         if (!factory_.isUsableAsObjectPropertyName(name)) {
             return raiseError("DataProperty key kind");
         }
 
         ParseNode* result;
         if (name->template is<NameNode>() && name->template as<NameNode>().atom() == cx_->names().proto) {
-            BINJS_TRY_VAR(result, factory_.newUnary(ParseNodeKind::MutateProtoExpr, start, expression));
+            BINJS_TRY_VAR(result, factory_.newUnary(ParseNodeKind::MutateProto, start, expression));
         } else {
             BINJS_TRY_VAR(result, factory_.newObjectMethodOrPropertyDefinition(name, expression, AccessorType::None));
         }
 
 Directive:
     build: |
         TokenPos pos = tokenizer_->pos(start);
         BINJS_TRY_DECL(result, factory_.newStringLiteral(rawValue, pos));
@@ -1167,17 +1167,17 @@ ListOfSwitchCase:
         BINJS_TRY_DECL(result, factory_.newStatementList(tokenizer_->pos(start)));
     append:
         factory_.addCaseStatementToList(result, item);
 
 ListOfVariableDeclarator:
     type-ok:
         ListNode*
     init: |
-        BINJS_TRY_DECL(result, factory_.newDeclarationList(ParseNodeKind::ConstStmt /*Placeholder*/,
+        BINJS_TRY_DECL(result, factory_.newDeclarationList(ParseNodeKind::ConstDecl /*Placeholder*/,
             tokenizer_->pos(start)));
 
 LiteralBooleanExpression:
     build:
         BINJS_TRY_DECL(result, factory_.newBooleanLiteral(value, tokenizer_->pos(start)));
 
 LiteralNumericExpression:
     build:
@@ -1281,17 +1281,17 @@ Script:
 
 ShorthandProperty:
     build: |
         MOZ_ASSERT(name->isKind(ParseNodeKind::Name));
         MOZ_ASSERT(!factory_.isUsableAsObjectPropertyName(name));
         BINJS_TRY_DECL(propName, factory_.newObjectLiteralPropertyName(name->template as<NameNode>().name(), tokenizer_->pos(start)));
 
         BINJS_TRY_DECL(result, factory_.newObjectMethodOrPropertyDefinition(propName, name, AccessorType::None));
-        result->setKind(ParseNodeKind::ShorthandExpr);
+        result->setKind(ParseNodeKind::Shorthand);
 
 SwitchCase:
     type-ok:
         CaseClause*
     build: |
         BINJS_TRY_DECL(result, factory_.newCaseOrDefault(start, test, consequent));
 
 SwitchDefault:
@@ -1422,16 +1422,18 @@ UnaryExpression:
           case UnaryOperator::Void:
             pnk = ParseNodeKind::VoidExpr;
             break;
           case UnaryOperator::Delete: {
             switch (operand->getKind()) {
               case ParseNodeKind::Name:
                 operand->setOp(JSOP_DELNAME);
                 pnk = ParseNodeKind::DeleteNameExpr;
+                BINJS_TRY(this->strictModeError(JSMSG_DEPRECATED_DELETE_OPERAND));
+                parseContext_->sc()->setBindingsAccessedDynamically();
                 break;
               case ParseNodeKind::DotExpr:
                 pnk = ParseNodeKind::DeletePropExpr;
                 break;
               case ParseNodeKind::ElemExpr:
                 pnk = ParseNodeKind::DeleteElemExpr;
                 break;
               default: