Skip to content

Commit 1ccc454

Browse files
authoredAug 23, 2018
Merge pull request #1674 from UnwrittenFun/fix/object-array-pattern-end
add end position to object and array patterns
2 parents 9eec6f8 + df4ca01 commit 1ccc454

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎src/parse/read/context.ts

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default function readContext(parser: Parser) {
5757

5858
errorOnAssignmentPattern(parser);
5959
parser.eat(']', true);
60+
context.end = parser.index;
6061
}
6162

6263
else if (parser.eat('{')) {
@@ -95,6 +96,7 @@ export default function readContext(parser: Parser) {
9596

9697
errorOnAssignmentPattern(parser);
9798
parser.eat('}', true);
99+
context.end = parser.index;
98100
}
99101

100102
else {

‎test/parser/samples/each-block-destructured/output.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
],
5656
"context": {
5757
"start": 18,
58-
"end": null,
58+
"end": 30,
5959
"type": "ArrayPattern",
6060
"elements": [
6161
{

0 commit comments

Comments
 (0)
Please sign in to comment.