From 7f811d95049c01d7a046c93f8242533003c1b691 Mon Sep 17 00:00:00 2001 From: Sakibul Mowla Date: Sat, 26 Oct 2019 12:22:39 +0100 Subject: [PATCH] Fix test, destructure with as assertion --- .../cast/destructure-and-assign/input.ts | 2 +- .../cast/destructure-and-assign/output.json | 123 ++++++++++-------- 2 files changed, 70 insertions(+), 55 deletions(-) diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts index b7a83210faa3..699cea6eb64d 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts @@ -1 +1 @@ -(a as number) = 42; +[a as number] = [42]; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json index f07df1678fb0..293db3ae845d 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 19, + "end": 21, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 19 + "column": 21 } }, "program": { "type": "Program", "start": 0, - "end": 19, + "end": 21, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 1, - "column": 19 + "column": 21 } }, "sourceType": "module", @@ -32,7 +32,7 @@ { "type": "ExpressionStatement", "start": 0, - "end": 19, + "end": 21, "loc": { "start": { "line": 1, @@ -40,13 +40,13 @@ }, "end": { "line": 1, - "column": 19 + "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 0, - "end": 18, + "end": 20, "loc": { "start": { "line": 1, @@ -54,65 +54,63 @@ }, "end": { "line": 1, - "column": 18 + "column": 20 } }, "operator": "=", "left": { - "type": "TSAsExpression", - "start": 1, - "end": 12, + "type": "ArrayPattern", + "start": 0, + "end": 13, "loc": { "start": { "line": 1, - "column": 1 + "column": 0 }, "end": { "line": 1, - "column": 12 + "column": 13 } }, - "expression": { - "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 + "elements": [ + { + "type": "Identifier", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - "typeAnnotation": { - "type": "TSNumberKeyword", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } } } - }, - "extra": { - "parenthesized": true, - "parenStart": 0 - } + ] }, "right": { - "type": "NumericLiteral", + "type": "ArrayExpression", "start": 16, - "end": 18, + "end": 20, "loc": { "start": { "line": 1, @@ -120,14 +118,31 @@ }, "end": { "line": 1, - "column": 18 + "column": 20 } }, - "extra": { - "rawValue": 42, - "raw": "42" - }, - "value": 42 + "elements": [ + { + "type": "NumericLiteral", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] } } }