From bbe5319f3b6eb82c605574a05f74d308ca6bcb31 Mon Sep 17 00:00:00 2001 From: James Birtles Date: Wed, 22 Aug 2018 17:50:19 +0100 Subject: [PATCH 1/2] add end position to object and array patterns --- src/parse/read/context.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parse/read/context.ts b/src/parse/read/context.ts index 77fd2cbf68..13d1e9ece1 100644 --- a/src/parse/read/context.ts +++ b/src/parse/read/context.ts @@ -57,6 +57,7 @@ export default function readContext(parser: Parser) { errorOnAssignmentPattern(parser); parser.eat(']', true); + context.end = parser.index; } else if (parser.eat('{')) { @@ -95,6 +96,7 @@ export default function readContext(parser: Parser) { errorOnAssignmentPattern(parser); parser.eat('}', true); + context.end = parser.index; } else { From df4ca0103d8c0c68f9277a4e0635b845a51a863a Mon Sep 17 00:00:00 2001 From: James Birtles Date: Wed, 22 Aug 2018 18:03:18 +0100 Subject: [PATCH 2/2] fix test --- test/parser/samples/each-block-destructured/output.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json index 554b0cdcb0..eba70b8750 100644 --- a/test/parser/samples/each-block-destructured/output.json +++ b/test/parser/samples/each-block-destructured/output.json @@ -55,7 +55,7 @@ ], "context": { "start": 18, - "end": null, + "end": 30, "type": "ArrayPattern", "elements": [ {