From 47afb97ae33c0cc38801cd2b21283b5ccdd58fdb Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Sun, 28 Nov 2021 16:24:18 +0900 Subject: [PATCH] Change start location of SvelteAwaitPendingBlock --- src/parser/converts/block.ts | 5 +- tests/fixtures/parser/ast/await01-output.json | 8 +- .../fixtures/parser/ast/await03-input.svelte | 9 + tests/fixtures/parser/ast/await03-output.json | 1378 +++++++++++++++++ .../ast/await03-prefer-const-result.json | 8 + .../parser/ast/await03-scope-output.json | 596 +++++++ .../07-hash-await/01-output.json | 8 +- .../07-hash-await/02-output.json | 4 +- .../07-hash-await/03-output.json | 4 +- .../parser/ast/ts-promise01-output.json | 4 +- .../ast/tutorial/await-blocks-output.json | 4 +- 11 files changed, 2011 insertions(+), 17 deletions(-) create mode 100644 tests/fixtures/parser/ast/await03-input.svelte create mode 100644 tests/fixtures/parser/ast/await03-output.json create mode 100644 tests/fixtures/parser/ast/await03-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/await03-scope-output.json diff --git a/src/parser/converts/block.ts b/src/parser/converts/block.ts index 59f8c274..73ba21fe 100644 --- a/src/parser/converts/block.ts +++ b/src/parser/converts/block.ts @@ -224,7 +224,10 @@ export function convertAwaitBlock( type: "SvelteAwaitPendingBlock", children: [], parent: awaitBlock, - ...ctx.getConvertLocation(node.pending), + ...ctx.getConvertLocation({ + start: awaitBlock.range[0], + end: node.pending.end, + }), } ctx.scriptLet.nestBlock(pendingBlock) pendingBlock.children.push( diff --git a/tests/fixtures/parser/ast/await01-output.json b/tests/fixtures/parser/ast/await01-output.json index 5af43d17..6081b217 100644 --- a/tests/fixtures/parser/ast/await01-output.json +++ b/tests/fixtures/parser/ast/await01-output.json @@ -226,13 +226,13 @@ } ], "range": [ - 70, + 51, 71 ], "loc": { "start": { "line": 5, - "column": 19 + "column": 0 }, "end": { "line": 6, @@ -392,13 +392,13 @@ } ], "range": [ - 117, + 98, 118 ], "loc": { "start": { "line": 10, - "column": 19 + "column": 0 }, "end": { "line": 11, diff --git a/tests/fixtures/parser/ast/await03-input.svelte b/tests/fixtures/parser/ast/await03-input.svelte new file mode 100644 index 00000000..26e013c2 --- /dev/null +++ b/tests/fixtures/parser/ast/await03-input.svelte @@ -0,0 +1,9 @@ + + +{#await expression}{:then}{:catch}{/await} + +{#await expression}{:then}{/await} + +{#await expression}{:catch}{/await} diff --git a/tests/fixtures/parser/ast/await03-output.json b/tests/fixtures/parser/ast/await03-output.json new file mode 100644 index 00000000..17e96db6 --- /dev/null +++ b/tests/fixtures/parser/ast/await03-output.json @@ -0,0 +1,1378 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "init": { + "type": "NewExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "range": [ + 26, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 13, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 9, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 40, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteAwaitBlock", + "expression": { + "type": "Identifier", + "name": "expression", + "range": [ + 59, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "pending": { + "type": "SvelteAwaitPendingBlock", + "children": [], + "range": [ + 51, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "then": { + "type": "SvelteAwaitThenBlock", + "value": null, + "children": [], + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "catch": { + "type": "SvelteAwaitCatchBlock", + "error": null, + "children": [], + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 34 + } + } + }, + "range": [ + 51, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 93, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 42 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "SvelteAwaitBlock", + "expression": { + "type": "Identifier", + "name": "expression", + "range": [ + 103, + 113 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "pending": { + "type": "SvelteAwaitPendingBlock", + "children": [], + "range": [ + 95, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "then": { + "type": "SvelteAwaitThenBlock", + "value": null, + "children": [], + "range": [ + 114, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "catch": null, + "range": [ + 95, + 129 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 129, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 34 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteAwaitBlock", + "expression": { + "type": "Identifier", + "name": "expression", + "range": [ + 139, + 149 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "pending": { + "type": "SvelteAwaitPendingBlock", + "children": [], + "range": [ + 131, + 150 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + "then": null, + "catch": { + "type": "SvelteAwaitCatchBlock", + "error": null, + "children": [], + "range": [ + 150, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "range": [ + 131, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 35 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#await", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "expression", + "range": [ + 59, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":then", + "range": [ + 71, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":catch", + "range": [ + 78, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/await", + "range": [ + 86, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 93, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 42 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#await", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "expression", + "range": [ + 103, + 113 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":then", + "range": [ + 115, + 120 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/await", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 7, + "column": 33 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 129, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 34 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#await", + "range": [ + 132, + 138 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "expression", + "range": [ + 139, + 149 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":catch", + "range": [ + 151, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 26 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/await", + "range": [ + 159, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 35 + } + } + } + ], + "range": [ + 0, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/await03-prefer-const-result.json b/tests/fixtures/parser/ast/await03-prefer-const-result.json new file mode 100644 index 00000000..64f71f78 --- /dev/null +++ b/tests/fixtures/parser/ast/await03-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "expression", + "line": 2, + "column": 5 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/await03-scope-output.json b/tests/fixtures/parser/ast/await03-scope-output.json new file mode 100644 index 00000000..9f372949 --- /dev/null +++ b/tests/fixtures/parser/ast/await03-scope-output.json @@ -0,0 +1,596 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "expression", + "identifiers": [ + { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "init": { + "type": "NewExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "range": [ + 26, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 13, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 59, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 103, + 113 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 139, + 149 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 59, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 103, + 113 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 139, + 149 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "expression", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/01-output.json b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/01-output.json index abcbb56a..6f651210 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/01-output.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/01-output.json @@ -44,13 +44,13 @@ } ], "range": [ - 19, + 0, 22 ], "loc": { "start": { "line": 1, - "column": 19 + "column": 0 }, "end": { "line": 1, @@ -244,13 +244,13 @@ } ], "range": [ - 81, + 62, 84 ], "loc": { "start": { "line": 2, - "column": 19 + "column": 0 }, "end": { "line": 2, diff --git a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/02-output.json b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/02-output.json index 9440722c..4c0f46a5 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/02-output.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/02-output.json @@ -190,13 +190,13 @@ } ], "range": [ - 16, + 0, 92 ], "loc": { "start": { "line": 1, - "column": 16 + "column": 0 }, "end": { "line": 4, diff --git a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/03-output.json b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/03-output.json index e5e3f042..ab06b9a6 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/03-output.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/07-hash-await/03-output.json @@ -190,13 +190,13 @@ } ], "range": [ - 16, + 0, 90 ], "loc": { "start": { "line": 1, - "column": 16 + "column": 0 }, "end": { "line": 4, diff --git a/tests/fixtures/parser/ast/ts-promise01-output.json b/tests/fixtures/parser/ast/ts-promise01-output.json index 339841b0..19d235a0 100644 --- a/tests/fixtures/parser/ast/ts-promise01-output.json +++ b/tests/fixtures/parser/ast/ts-promise01-output.json @@ -710,13 +710,13 @@ } ], "range": [ - 122, + 106, 142 ], "loc": { "start": { "line": 5, - "column": 16 + "column": 0 }, "end": { "line": 7, diff --git a/tests/fixtures/parser/ast/tutorial/await-blocks-output.json b/tests/fixtures/parser/ast/tutorial/await-blocks-output.json index b0057cd8..d24b0ebb 100644 --- a/tests/fixtures/parser/ast/tutorial/await-blocks-output.json +++ b/tests/fixtures/parser/ast/tutorial/await-blocks-output.json @@ -1277,13 +1277,13 @@ } ], "range": [ - 428, + 412, 448 ], "loc": { "start": { "line": 25, - "column": 16 + "column": 0 }, "end": { "line": 27,