From 49555b4b63038052cf4b574255818baed7a9cbfc Mon Sep 17 00:00:00 2001 From: James Birtles Date: Tue, 21 Aug 2018 21:08:46 +0100 Subject: [PATCH 1/2] add some missing ObjectPattern properties --- src/parse/read/context.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parse/read/context.ts b/src/parse/read/context.ts index 77fd2cbf68..51bce0a754 100644 --- a/src/parse/read/context.ts +++ b/src/parse/read/context.ts @@ -11,6 +11,8 @@ type Property = { start: number; end: number; type: 'Property'; + kind: string; + shorthand: boolean; key: Identifier; value: Context; }; @@ -84,6 +86,8 @@ export default function readContext(parser: Parser) { start, end: value.end, type: 'Property', + kind: 'init', + shorthand: key === value, key, value }; From 31250868aeec8a3796f73c5cd0e1e2f5a58a18c0 Mon Sep 17 00:00:00 2001 From: James Birtles Date: Tue, 21 Aug 2018 21:17:51 +0100 Subject: [PATCH 2/2] better shorthand detection --- src/parse/read/context.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse/read/context.ts b/src/parse/read/context.ts index 51bce0a754..e7a1523f2a 100644 --- a/src/parse/read/context.ts +++ b/src/parse/read/context.ts @@ -87,7 +87,7 @@ export default function readContext(parser: Parser) { end: value.end, type: 'Property', kind: 'init', - shorthand: key === value, + shorthand: value.type === 'Identifier' && value.name === name, key, value };