fix(babel-parser): Fix end of range of SequenceExpression (#13731)
This commit is contained in:
parent
0d5ca876fd
commit
62e42a3f60
@ -1735,8 +1735,7 @@ export default class ExpressionParser extends LValParser {
|
||||
val.expressions = exprList;
|
||||
// finish node at current location so it can pick up comments after `)`
|
||||
this.finishNode(val, "SequenceExpression");
|
||||
val.end = innerEndPos;
|
||||
val.loc.end = innerEndLoc;
|
||||
this.resetEndLocation(val, innerEndPos, innerEndLoc);
|
||||
} else {
|
||||
val = exprList[0];
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
var a = 1;
|
||||
|
||||
var b = a + 1;
|
||||
|
||||
(1, 2);
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}},
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":7}},
|
||||
"range": [
|
||||
0,
|
||||
26
|
||||
35
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}},
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":7}},
|
||||
"range": [
|
||||
0,
|
||||
26
|
||||
35
|
||||
],
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
@ -114,6 +114,54 @@
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":28,"end":35,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}},
|
||||
"range": [
|
||||
28,
|
||||
35
|
||||
],
|
||||
"expression": {
|
||||
"type": "SequenceExpression",
|
||||
"start":29,"end":33,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":5}},
|
||||
"range": [
|
||||
29,
|
||||
33
|
||||
],
|
||||
"expressions": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start":29,"end":30,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":2}},
|
||||
"range": [
|
||||
29,
|
||||
30
|
||||
],
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start":32,"end":33,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5}},
|
||||
"range": [
|
||||
32,
|
||||
33
|
||||
],
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 28
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user