Skip to content

Commit

Permalink
Enter new prodParam scope
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Dec 11, 2020
1 parent 001d471 commit 1640f64
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/babel-parser/src/parser/expression.js
Expand Up @@ -2641,8 +2641,14 @@ export default class ExpressionParser extends LValParser {
this.state.exportedIdentifiers = [];
this.eat(tt.braceL);
this.scope.enter(SCOPE_OTHER);
let paramFlags = PARAM;
if (this.hasPlugin("topLevelAwait")) {
paramFlags |= PARAM_AWAIT;
}
this.prodParam.enter(paramFlags);
this.parseBlockOrModuleBlockBody(node.body, undefined, true, tt.braceR);
this.scope.exit();
this.prodParam.exit();
this.eat(tt.braceR);
this.state.labels = oldLabels;
this.state.exportedIdentifiers = oldExportedIdentifiers;
Expand Down
@@ -0,0 +1 @@
module { await 3 };
@@ -0,0 +1,4 @@
{
"sourceType": "module",
"plugins": ["moduleBlocks", "topLevelAwait"]
}
@@ -0,0 +1,40 @@
{
"type": "File",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
"program": {
"type": "Program",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
"expression": {
"type": "ModuleExpression",
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
"body": [
{
"type": "ExpressionStatement",
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}},
"expression": {
"type": "AwaitExpression",
"start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}},
"argument": {
"type": "NumericLiteral",
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}},
"extra": {
"rawValue": 3,
"raw": "3"
},
"value": 3
}
}
}
]
}
}
],
"directives": []
}
}

0 comments on commit 1640f64

Please sign in to comment.