Bug 1524965 - Part 1: Allocate StatementKind::Switch context in BinAST. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Fri, 08 Feb 2019 12:13:53 +0900
changeset 516093 7fce2598a3de
parent 516092 9849e6b02bc2
child 516094 30e403f80bfd
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1524965
milestone67.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 1524965 - Part 1: Allocate StatementKind::Switch context 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
@@ -3918,17 +3918,17 @@ JS::Result<ParseNode*> BinASTParser<Tok>
   BINJS_TRY(CheckRecursionLimit(cx_));
 
 #if defined(DEBUG)
   const BinField expected_fields[2] = {BinField::Discriminant, BinField::Cases};
   MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif  // defined(DEBUG)
 
   BINJS_MOZ_TRY_DECL(discriminant, parseExpression());
-
+  ParseContext::Statement stmt(parseContext_, StatementKind::Switch);
   BINJS_MOZ_TRY_DECL(cases, parseListOfSwitchCase());
 
   BINJS_TRY_DECL(scope, factory_.newLexicalScope(nullptr, cases));
   BINJS_TRY_DECL(result, factory_.newSwitchStatement(start, discriminant, scope,
                                                      /* hasDefault = */ false));
   return result;
 }
 
@@ -3942,17 +3942,17 @@ BinASTParser<Tok>::parseInterfaceSwitchS
 #if defined(DEBUG)
   const BinField expected_fields[4] = {
       BinField::Discriminant, BinField::PreDefaultCases, BinField::DefaultCase,
       BinField::PostDefaultCases};
   MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif  // defined(DEBUG)
 
   BINJS_MOZ_TRY_DECL(discriminant, parseExpression());
-
+  ParseContext::Statement stmt(parseContext_, StatementKind::Switch);
   BINJS_MOZ_TRY_DECL(preDefaultCases, parseListOfSwitchCase());
 
   BINJS_MOZ_TRY_DECL(defaultCase, parseSwitchDefault());
 
   BINJS_MOZ_TRY_DECL(postDefaultCases, parseListOfSwitchCase());
 
   // Concatenate `preDefaultCase`, `defaultCase`, `postDefaultCase`
   auto cases = preDefaultCases;
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -1387,23 +1387,31 @@ SwitchCase:
     BINJS_TRY_DECL(result, factory_.newCaseOrDefault(start, test, consequent));
 
 SwitchDefault:
   build: |
     BINJS_TRY_DECL(result,
                    factory_.newCaseOrDefault(start, nullptr, consequent));
 
 SwitchStatement:
+  fields:
+    discriminant:
+      after: |
+        ParseContext::Statement stmt(parseContext_, StatementKind::Switch);
   build: |
     BINJS_TRY_DECL(scope, factory_.newLexicalScope(nullptr, cases));
     BINJS_TRY_DECL(result,
                    factory_.newSwitchStatement(start, discriminant, scope,
                                                /* hasDefault = */ false));
 
 SwitchStatementWithDefault:
+  fields:
+    discriminant:
+      after: |
+        ParseContext::Statement stmt(parseContext_, StatementKind::Switch);
   build: |
     // Concatenate `preDefaultCase`, `defaultCase`, `postDefaultCase`
     auto cases = preDefaultCases;
     factory_.addList(cases, defaultCase);
     ParseNode* iter = postDefaultCases->head();
     while (iter) {
       ParseNode* next = iter->pn_next;
       factory_.addList(cases, iter);