Bug 1496330 - Properly handle dynamic bindings in with blocks in BinAST. (r=arai)
authorEric Faust <efausbmo@gmail.com>
Mon, 15 Oct 2018 17:17:58 -0400
changeset 489584 f7d0546ee3cecaef21bf86e44717d84632d61580
parent 489583 521f2719026367be8315e33f5f9bae8a4aa65f15
child 489585 4ba3494b8b7637420f6b01eaf5f1199227798915
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersarai
bugs1496330
milestone64.0a1
Bug 1496330 - Properly handle dynamic bindings in with blocks in BinAST. (r=arai)
js/src/frontend/BinSource-auto.cpp
js/src/frontend/BinSource.yaml
--- a/js/src/frontend/BinSource-auto.cpp
+++ b/js/src/frontend/BinSource-auto.cpp
@@ -5082,16 +5082,17 @@ BinASTParser<Tok>::parseInterfaceWithSta
     const BinField expected_fields[2] = { BinField::Object, BinField::Body };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
 
     BINJS_MOZ_TRY_DECL(object, parseExpression());
 
     BINJS_MOZ_TRY_DECL(body, parseStatement());
 
+    parseContext_->sc()->setBindingsAccessedDynamically();
     BINJS_TRY_DECL(result, factory_.newWithStatement(start, object, body));
     return result;
 }
 
 template<typename Tok> JS::Result<ParseNode*>
 BinASTParser<Tok>::parseInterfaceYieldExpression(const size_t start, const BinKind kind, const BinFields& fields)
 {
     return raiseError("FIXME: Not implemented yet in this preview release (YieldExpression)");
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -1337,10 +1337,11 @@ VariableDeclarator:
 
 WhileStatement:
     init:
         ParseContext::Statement stmt(parseContext_, StatementKind::WhileLoop);
     build:
         BINJS_TRY_DECL(result, factory_.newWhileStatement(start, test, body));
 
 WithStatement:
-    build:
+    build: |
+        parseContext_->sc()->setBindingsAccessedDynamically();
         BINJS_TRY_DECL(result, factory_.newWithStatement(start, object, body));