-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
startIndex
parser option (#16849)
- Loading branch information
1 parent
b8d6334
commit 77bc5d5
Showing
23 changed files
with
251 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
.../core/categorized/invalid-startindex-and-startline-specified-without-startcolumn/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
call(1); | ||
run(2); |
5 changes: 5 additions & 0 deletions
5
...e/categorized/invalid-startindex-and-startline-specified-without-startcolumn/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"startIndex": 3, | ||
"startLine": 2, | ||
"throws": "With a `startLine > 1` you must also specify `startIndex` and `startColumn`." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/core/categorized/startindex-specified/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
call(1); | ||
run(2); |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/core/categorized/startindex-specified/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"startIndex": 3 | ||
} |
61 changes: 61 additions & 0 deletions
61
packages/babel-parser/test/fixtures/core/categorized/startindex-specified/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"type": "File", | ||
"start":3,"end":19,"loc":{"start":{"line":1,"column":3,"index":3},"end":{"line":2,"column":10,"index":19}}, | ||
"program": { | ||
"type": "Program", | ||
"start":3,"end":19,"loc":{"start":{"line":1,"column":3,"index":3},"end":{"line":2,"column":10,"index":19}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":3,"end":11,"loc":{"start":{"line":1,"column":6,"index":3},"end":{"line":1,"column":14,"index":11}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":3,"end":10,"loc":{"start":{"line":1,"column":6,"index":3},"end":{"line":1,"column":13,"index":10}}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start":3,"end":7,"loc":{"start":{"line":1,"column":6,"index":3},"end":{"line":1,"column":10,"index":7},"identifierName":"call"}, | ||
"name": "call" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "NumericLiteral", | ||
"start":8,"end":9,"loc":{"start":{"line":1,"column":11,"index":8},"end":{"line":1,"column":12,"index":9}}, | ||
"extra": { | ||
"rawValue": 1, | ||
"raw": "" | ||
}, | ||
"value": 1 | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":12,"end":19,"loc":{"start":{"line":2,"column":3,"index":12},"end":{"line":2,"column":10,"index":19}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":12,"end":18,"loc":{"start":{"line":2,"column":3,"index":12},"end":{"line":2,"column":9,"index":18}}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start":12,"end":15,"loc":{"start":{"line":2,"column":3,"index":12},"end":{"line":2,"column":6,"index":15},"identifierName":"run"}, | ||
"name": "run" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "NumericLiteral", | ||
"start":16,"end":17,"loc":{"start":{"line":2,"column":7,"index":16},"end":{"line":2,"column":8,"index":17}}, | ||
"extra": { | ||
"rawValue": 2, | ||
"raw": "" | ||
}, | ||
"value": 2 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...er/test/fixtures/core/categorized/startindex-startline-and-startcolumn-specified/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
call(1); | ||
run(2); |
5 changes: 5 additions & 0 deletions
5
...est/fixtures/core/categorized/startindex-startline-and-startcolumn-specified/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"startIndex": 3, | ||
"startLine": 3, | ||
"startColumn": 3 | ||
} |
61 changes: 61 additions & 0 deletions
61
...test/fixtures/core/categorized/startindex-startline-and-startcolumn-specified/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"type": "File", | ||
"start":3,"end":19,"loc":{"start":{"line":3,"column":3,"index":3},"end":{"line":4,"column":10,"index":19}}, | ||
"program": { | ||
"type": "Program", | ||
"start":3,"end":19,"loc":{"start":{"line":3,"column":3,"index":3},"end":{"line":4,"column":10,"index":19}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":3,"end":11,"loc":{"start":{"line":3,"column":6,"index":3},"end":{"line":3,"column":14,"index":11}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":3,"end":10,"loc":{"start":{"line":3,"column":6,"index":3},"end":{"line":3,"column":13,"index":10}}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start":3,"end":7,"loc":{"start":{"line":3,"column":6,"index":3},"end":{"line":3,"column":10,"index":7},"identifierName":"call"}, | ||
"name": "call" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "NumericLiteral", | ||
"start":8,"end":9,"loc":{"start":{"line":3,"column":11,"index":8},"end":{"line":3,"column":12,"index":9}}, | ||
"extra": { | ||
"rawValue": 1, | ||
"raw": "" | ||
}, | ||
"value": 1 | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":12,"end":19,"loc":{"start":{"line":4,"column":3,"index":12},"end":{"line":4,"column":10,"index":19}}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start":12,"end":18,"loc":{"start":{"line":4,"column":3,"index":12},"end":{"line":4,"column":9,"index":18}}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start":12,"end":15,"loc":{"start":{"line":4,"column":3,"index":12},"end":{"line":4,"column":6,"index":15},"identifierName":"run"}, | ||
"name": "run" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "NumericLiteral", | ||
"start":16,"end":17,"loc":{"start":{"line":4,"column":7,"index":16},"end":{"line":4,"column":8,"index":17}}, | ||
"extra": { | ||
"rawValue": 2, | ||
"raw": "" | ||
}, | ||
"value": 2 | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...arser/test/fixtures/core/categorized/startline-and-startcolumn-specified-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
call(1); | ||
run(2); |
5 changes: 5 additions & 0 deletions
5
...r/test/fixtures/core/categorized/startline-and-startcolumn-specified-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"startLine": 3, | ||
"startColumn": 3 | ||
} |
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...el-parser/test/fixtures/core/categorized/startline-and-startcolumn-specified/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"startLine": 3, | ||
"startColumn": 3 | ||
"startColumn": 3, | ||
"throws": "With a `startLine > 1` you must also specify `startIndex` and `startColumn`." | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/core/categorized/startline-specified-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
call(1); | ||
run(2); |
4 changes: 4 additions & 0 deletions
4
...ages/babel-parser/test/fixtures/core/categorized/startline-specified-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"startLine": 3 | ||
} |
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
packages/babel-parser/test/fixtures/core/categorized/startline-specified/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"startLine": 3 | ||
"BABEL_8_BREAKING": true, | ||
"startLine": 3, | ||
"throws": "With a `startLine > 1` you must also specify `startIndex` and `startColumn`." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.