Skip to content

Commit

Permalink
fix: correctly set innerEndPos in CoverParenthesizedExpressionAndArro…
Browse files Browse the repository at this point in the history
…wParameterList (#11847)
  • Loading branch information
JLHwung committed Jul 16, 2020
1 parent 8f191ea commit f4eeff9
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/babel-parser/src/parser/expression.js
Expand Up @@ -1371,8 +1371,8 @@ export default class ExpressionParser extends LValParser {
}
}

const innerEndPos = this.state.start;
const innerEndLoc = this.state.startLoc;
const innerEndPos = this.state.lastTokEnd;
const innerEndLoc = this.state.lastTokEndLoc;
this.expect(tt.parenR);

this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
Expand Down
@@ -0,0 +1,4 @@
a = (
b,
c
)
@@ -0,0 +1,47 @@
{
"type": "File",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"program": {
"type": "Program",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"expression": {
"type": "AssignmentExpression",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"operator": "=",
"left": {
"type": "Identifier",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
"name": "a"
},
"right": {
"type": "SequenceExpression",
"start":8,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}},
"expressions": [
{
"type": "Identifier",
"start":8,"end":9,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"b"},
"name": "b"
},
{
"type": "Identifier",
"start":13,"end":14,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"c"},
"name": "c"
}
],
"extra": {
"parenthesized": true,
"parenStart": 4
}
}
}
}
],
"directives": []
}
}

0 comments on commit f4eeff9

Please sign in to comment.