From be66a278f57f84c6057e021e37bfe559f8c0b935 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 bf16371c9faadb9e800214d4fec6254a52fe08d4 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": [ {