Allow module block to start a member expression (#13573)
* Accept module in primaryExpression * Add module blocks to primaryExpression * Fix package.json * Fix yarn.lock * Fix yarn.lock * Remove package.tgz file
This commit is contained in:
parent
fa439d6a73
commit
2c6db56696
@ -512,13 +512,6 @@ export default class ExpressionParser extends LValParser {
|
|||||||
if (!sawUnary) this.checkExponentialAfterUnary(expr);
|
if (!sawUnary) this.checkExponentialAfterUnary(expr);
|
||||||
return expr;
|
return expr;
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
this.isContextual("module") &&
|
|
||||||
this.lookaheadCharCode() === charCodes.leftCurlyBrace &&
|
|
||||||
!this.hasFollowingLineBreak()
|
|
||||||
) {
|
|
||||||
return this.parseModuleExpression();
|
|
||||||
}
|
|
||||||
const update = this.match(tt.incDec);
|
const update = this.match(tt.incDec);
|
||||||
const node = this.startNode();
|
const node = this.startNode();
|
||||||
if (this.state.type.prefix) {
|
if (this.state.type.prefix) {
|
||||||
@ -1002,6 +995,13 @@ export default class ExpressionParser extends LValParser {
|
|||||||
return this.finishNode(node, "ThisExpression");
|
return this.finishNode(node, "ThisExpression");
|
||||||
|
|
||||||
case tt.name: {
|
case tt.name: {
|
||||||
|
if (
|
||||||
|
this.isContextual("module") &&
|
||||||
|
this.lookaheadCharCode() === charCodes.leftCurlyBrace &&
|
||||||
|
!this.hasFollowingLineBreak()
|
||||||
|
) {
|
||||||
|
return this.parseModuleExpression();
|
||||||
|
}
|
||||||
const canBeArrow = this.state.potentialArrowAt === this.state.start;
|
const canBeArrow = this.state.potentialArrowAt === this.state.start;
|
||||||
const containsEsc = this.state.containsEsc;
|
const containsEsc = this.state.containsEsc;
|
||||||
const id = this.parseIdentifier();
|
const id = this.parseIdentifier();
|
||||||
|
|||||||
@ -3,4 +3,4 @@
|
|||||||
"plugins": [
|
"plugins": [
|
||||||
"doExpressions"
|
"doExpressions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
module {}.foo
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||||
|
"expression": {
|
||||||
|
"type": "MemberExpression",
|
||||||
|
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||||
|
"object": {
|
||||||
|
"type": "ModuleExpression",
|
||||||
|
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||||
|
"body": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"property": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user