Async do expression should start at async (#13534)
This commit is contained in:
parent
bfd2f8f4b1
commit
8a3e0fd960
@ -1017,7 +1017,7 @@ export default class ExpressionParser extends LValParser {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
} else if (this.match(tt._do)) {
|
} else if (this.match(tt._do)) {
|
||||||
return this.parseDo(true);
|
return this.parseDo(this.startNodeAtNode(id), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1034,7 +1034,7 @@ export default class ExpressionParser extends LValParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case tt._do: {
|
case tt._do: {
|
||||||
return this.parseDo(false);
|
return this.parseDo(this.startNode(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
case tt.slash:
|
case tt.slash:
|
||||||
@ -1207,12 +1207,11 @@ export default class ExpressionParser extends LValParser {
|
|||||||
|
|
||||||
// https://github.com/tc39/proposal-do-expressions
|
// https://github.com/tc39/proposal-do-expressions
|
||||||
// https://github.com/tc39/proposal-async-do-expressions
|
// https://github.com/tc39/proposal-async-do-expressions
|
||||||
parseDo(isAsync: boolean): N.DoExpression {
|
parseDo(node: N.Node, isAsync: boolean): N.DoExpression {
|
||||||
this.expectPlugin("doExpressions");
|
this.expectPlugin("doExpressions");
|
||||||
if (isAsync) {
|
if (isAsync) {
|
||||||
this.expectPlugin("asyncDoExpressions");
|
this.expectPlugin("asyncDoExpressions");
|
||||||
}
|
}
|
||||||
const node = this.startNode();
|
|
||||||
node.async = isAsync;
|
node.async = isAsync;
|
||||||
this.next(); // eat `do`
|
this.next(); // eat `do`
|
||||||
const oldLabels = this.state.labels;
|
const oldLabels = this.state.labels;
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}},
|
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"init": {
|
"init": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":14,"end":82,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}},
|
"start":8,"end":82,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}},
|
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
"init": {
|
"init": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":65,"end":92,"loc":{"start":{"line":4,"column":20},"end":{"line":6,"column":7}},
|
"start":59,"end":92,"loc":{"start":{"line":4,"column":14},"end":{"line":6,"column":7}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
"start":27,"end":60,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}},
|
"start":27,"end":60,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}},
|
||||||
"argument": {
|
"argument": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":39,"end":60,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":3}},
|
"start":33,"end":60,"loc":{"start":{"line":2,"column":8},"end":{"line":4,"column":3}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
"start":20,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}},
|
"start":20,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}},
|
||||||
"argument": {
|
"argument": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":33,"end":55,"loc":{"start":{"line":2,"column":15},"end":{"line":4,"column":3}},
|
"start":27,"end":55,"loc":{"start":{"line":2,"column":9},"end":{"line":4,"column":3}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"init": {
|
"init": {
|
||||||
"type": "DoExpression",
|
"type": "DoExpression",
|
||||||
"start":14,"end":53,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
"start":8,"end":53,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}},
|
||||||
"async": true,
|
"async": true,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "BlockStatement",
|
"type": "BlockStatement",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user