diff --git a/.changeset/honest-mangos-wave.md b/.changeset/honest-mangos-wave.md new file mode 100644 index 00000000..f4eb02cc --- /dev/null +++ b/.changeset/honest-mangos-wave.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +fix: incorrect location when there is whitespace at the beginning of block diff --git a/src/parser/converts/block.ts b/src/parser/converts/block.ts index f8beb955..d9bb6fb1 100644 --- a/src/parser/converts/block.ts +++ b/src/parser/converts/block.ts @@ -22,7 +22,11 @@ import { getWithLoc, indexOf, lastIndexOf } from "./common"; import type * as ESTree from "estree"; /** Get start index of block */ -function startBlockIndex(code: string, endIndex: number): number { +function startBlockIndex( + code: string, + endIndex: number, + block: string, +): number { return lastIndexOf( code, (c, index) => { @@ -34,7 +38,7 @@ function startBlockIndex(code: string, endIndex: number): number { if (!nextC.trim()) { continue; } - return code.startsWith("#if", next) || code.startsWith(":else", next); + return code.startsWith(block, next); } return false; }, @@ -62,9 +66,11 @@ export function convertIfBlock( ): SvelteIfBlock { // {#if expr} {:else} {/if} // {:else if expr} {/if} - const nodeStart = elseif - ? startBlockIndex(ctx.code, node.start - 1) - : node.start; + const nodeStart = startBlockIndex( + ctx.code, + elseif ? node.start - 1 : node.start, + elseif ? ":else" : "#if", + ); const ifBlock: SvelteIfBlock = { type: "SvelteIfBlock", elseif: Boolean(elseif), @@ -90,7 +96,15 @@ export function convertIfBlock( return ifBlock; } - const elseStart = startBlockIndex(ctx.code, node.else.start - 1); + let baseStart = node.else.start; + if (node.else.children.length === 1) { + const c = node.else.children[0]; + if (c.type === "IfBlock" && c.elseif) { + baseStart = Math.min(baseStart, c.start, getWithLoc(c.expression).start); + } + } + + const elseStart = startBlockIndex(ctx.code, baseStart - 1, ":else"); if (node.else.children.length === 1) { const c = node.else.children[0]; @@ -145,6 +159,7 @@ export function convertEachBlock( ctx: Context, ): SvelteEachBlock { // {#each expr as item, index (key)} {/each} + const nodeStart = startBlockIndex(ctx.code, node.start, "#each"); const eachBlock: SvelteEachBlock = { type: "SvelteEachBlock", expression: null as any, @@ -154,7 +169,7 @@ export function convertEachBlock( children: [], else: null, parent, - ...ctx.getConvertLocation(node), + ...ctx.getConvertLocation({ start: nodeStart, end: node.end }), }; let indexRange: null | { start: number; end: number } = null; @@ -199,7 +214,7 @@ export function convertEachBlock( return eachBlock; } - const elseStart = startBlockIndex(ctx.code, node.else.start - 1); + const elseStart = startBlockIndex(ctx.code, node.else.start - 1, ":else"); const elseBlock: SvelteElseBlockAlone = { type: "SvelteElseBlock", @@ -227,6 +242,7 @@ export function convertAwaitBlock( parent: SvelteAwaitBlock["parent"], ctx: Context, ): SvelteAwaitBlock { + const nodeStart = startBlockIndex(ctx.code, node.start, "#await"); const awaitBlock = { type: "SvelteAwaitBlock", expression: null as any, @@ -235,7 +251,7 @@ export function convertAwaitBlock( then: null as any, catch: null as any, parent, - ...ctx.getConvertLocation(node), + ...ctx.getConvertLocation({ start: nodeStart, end: node.end }), } as SvelteAwaitBlock; ctx.scriptLet.addExpression( @@ -413,12 +429,13 @@ export function convertKeyBlock( parent: SvelteKeyBlock["parent"], ctx: Context, ): SvelteKeyBlock { + const nodeStart = startBlockIndex(ctx.code, node.start, "#key"); const keyBlock: SvelteKeyBlock = { type: "SvelteKeyBlock", expression: null as any, children: [], parent, - ...ctx.getConvertLocation(node), + ...ctx.getConvertLocation({ start: nodeStart, end: node.end }), }; ctx.scriptLet.addExpression(node.expression, keyBlock, null, (expression) => { @@ -441,13 +458,14 @@ export function convertSnippetBlock( ctx: Context, ): SvelteSnippetBlock { // {#snippet x(args)}...{/snippet} + const nodeStart = startBlockIndex(ctx.code, node.start, "#snippet"); const snippetBlock: SvelteSnippetBlock = { type: "SvelteSnippetBlock", id: null as any, context: null as any, children: [], parent, - ...ctx.getConvertLocation(node), + ...ctx.getConvertLocation({ start: nodeStart, end: node.end }), }; const closeParenIndex = ctx.code.indexOf( diff --git a/tests/fixtures/parser/ast/if-block01-requirements.json b/tests/fixtures/parser/ast/if-block01-requirements.json deleted file mode 100644 index 62679df4..00000000 --- a/tests/fixtures/parser/ast/if-block01-requirements.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "FIXME": "Probably a bug in the current Svelte v5. The position information in the else block is incorrect.", - "parse": { - "svelte": "^4 || ^3" - } -} diff --git a/tests/fixtures/parser/ast/newline-in-blocks-input.svelte b/tests/fixtures/parser/ast/newline-in-blocks-input.svelte new file mode 100644 index 00000000..3c964936 --- /dev/null +++ b/tests/fixtures/parser/ast/newline-in-blocks-input.svelte @@ -0,0 +1,53 @@ + +{ +#await +expression +} +... +{ +:then +name +} +... +{ +:catch +name +} +... +{ +/await +} + +{ +#each +cats +as +{ +id, +name +} +, +i +} +... +{ +/each +} + +{ +#if +a +} +... +{ +/if +} + +{ +#key +value +} +... +{ +/key +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/newline-in-blocks-no-undef-result.json b/tests/fixtures/parser/ast/newline-in-blocks-no-undef-result.json new file mode 100644 index 00000000..cf19e46c --- /dev/null +++ b/tests/fixtures/parser/ast/newline-in-blocks-no-undef-result.json @@ -0,0 +1,26 @@ +[ + { + "ruleId": "no-undef", + "code": "expression", + "line": 4, + "column": 1 + }, + { + "ruleId": "no-undef", + "code": "cats", + "line": 23, + "column": 1 + }, + { + "ruleId": "no-undef", + "code": "a", + "line": 39, + "column": 1 + }, + { + "ruleId": "no-undef", + "code": "value", + "line": 48, + "column": 1 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/newline-in-blocks-no-unused-vars-result.json b/tests/fixtures/parser/ast/newline-in-blocks-no-unused-vars-result.json new file mode 100644 index 00000000..43c16b2b --- /dev/null +++ b/tests/fixtures/parser/ast/newline-in-blocks-no-unused-vars-result.json @@ -0,0 +1,32 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "name", + "line": 9, + "column": 1 + }, + { + "ruleId": "no-unused-vars", + "code": "name", + "line": 14, + "column": 1 + }, + { + "ruleId": "no-unused-vars", + "code": "id", + "line": 26, + "column": 1 + }, + { + "ruleId": "no-unused-vars", + "code": "name", + "line": 27, + "column": 1 + }, + { + "ruleId": "no-unused-vars", + "code": "i", + "line": 30, + "column": 1 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/newline-in-blocks-output.json b/tests/fixtures/parser/ast/newline-in-blocks-output.json new file mode 100644 index 00000000..4eb7dd00 --- /dev/null +++ b/tests/fixtures/parser/ast/newline-in-blocks-output.json @@ -0,0 +1,2040 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteHTMLComment", + "value": "await", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "SvelteAwaitBlock", + "kind": "await", + "expression": { + "type": "Identifier", + "name": "expression", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "pending": { + "type": "SvelteAwaitPendingBlock", + "children": [ + { + "type": "SvelteText", + "value": "\n...\n", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "range": [ + 13, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + "then": { + "type": "SvelteAwaitThenBlock", + "awaitThen": false, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n...\n", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + ], + "range": [ + 39, + 58 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + "catch": { + "type": "SvelteAwaitCatchBlock", + "awaitCatch": false, + "error": { + "type": "Identifier", + "name": "name", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n...\n", + "range": [ + 73, + 78 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 17, + "column": 0 + } + } + } + ], + "range": [ + 58, + 78 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + "range": [ + 13, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 20, + "column": 0 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": "each", + "range": [ + 89, + 100 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 21, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "context": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + } + ], + "range": [ + 117, + 129 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + "index": { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "key": null, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 0 + } + } + } + ], + "else": null, + "range": [ + 101, + 149 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 36, + "column": 0 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": "if", + "range": [ + 150, + 159 + ], + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 36, + "column": 9 + }, + "end": { + "line": 37, + "column": 0 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 169, + 174 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 42, + "column": 0 + } + } + } + ], + "else": null, + "range": [ + 160, + 181 + ], + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 44, + "column": 1 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 45, + "column": 0 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": "key", + "range": [ + 182, + 192 + ], + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 45, + "column": 10 + }, + "end": { + "line": 46, + "column": 0 + } + } + }, + { + "type": "SvelteKeyBlock", + "expression": { + "type": "Identifier", + "name": "value", + "range": [ + 200, + 205 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 51, + "column": 0 + } + } + } + ], + "range": [ + 193, + 220 + ], + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 53, + "column": 1 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "HTMLComment", + "value": "", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#await", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "expression", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":then", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":catch", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/await", + "range": [ + 80, + 86 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 20, + "column": 0 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 89, + 100 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 21, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 114, + 116 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 32, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 136, + 139 + ], + "loc": { + "start": { + "line": 32, + "column": 0 + }, + "end": { + "line": 32, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 33, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 33, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 142, + 147 + ], + "loc": { + "start": { + "line": 34, + "column": 0 + }, + "end": { + "line": 34, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 36, + "column": 0 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 150, + 159 + ], + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 36, + "column": 9 + }, + "end": { + "line": 37, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 162, + 165 + ], + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 41, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 170, + 173 + ], + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 42, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 42, + "column": 0 + }, + "end": { + "line": 42, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 45, + "column": 0 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 182, + 192 + ], + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 45, + "column": 10 + }, + "end": { + "line": 46, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#key", + "range": [ + 195, + 199 + ], + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 200, + 205 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 49, + "column": 0 + }, + "end": { + "line": 49, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 50, + "column": 0 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 50, + "column": 3 + }, + "end": { + "line": 51, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/key", + "range": [ + 214, + 218 + ], + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 219, + 220 + ], + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 1 + } + } + } + ], + "range": [ + 0, + 220 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 53, + "column": 1 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/newline-in-blocks-scope-output.json b/tests/fixtures/parser/ast/newline-in-blocks-scope-output.json new file mode 100644 index 00000000..b7426edf --- /dev/null +++ b/tests/fixtures/parser/ast/newline-in-blocks-scope-output.json @@ -0,0 +1,1330 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 200, + 205 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "name", + "identifiers": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "name", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + "node": { + "type": "SvelteAwaitThenBlock", + "awaitThen": false, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n...\n", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + ], + "range": [ + 39, + 58 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "name", + "identifiers": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "name", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + "node": { + "type": "SvelteAwaitCatchBlock", + "awaitCatch": false, + "error": { + "type": "Identifier", + "name": "name", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n...\n", + "range": [ + 73, + 78 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 17, + "column": 0 + } + } + } + ], + "range": [ + 58, + 78 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 17, + "column": 0 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "id", + "identifiers": [ + { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "context": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + } + ], + "range": [ + 117, + 129 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + "index": { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "key": null, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 0 + } + } + } + ], + "else": null, + "range": [ + 101, + 149 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + } + } + ], + "references": [] + }, + { + "name": "name", + "identifiers": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "context": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + } + ], + "range": [ + 117, + 129 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + "index": { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "key": null, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 0 + } + } + } + ], + "else": null, + "range": [ + 101, + 149 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + } + } + ], + "references": [] + }, + { + "name": "i", + "identifiers": [ + { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "context": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "id", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 2 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "name", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + }, + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 4 + } + } + } + ], + "range": [ + 117, + 129 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + "index": { + "type": "Identifier", + "name": "i", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "key": null, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 0 + } + } + } + ], + "else": null, + "range": [ + 101, + 149 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 200, + 205 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "expression", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "cats", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 4 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 200, + 205 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file