diff --git a/.changeset/curly-turkeys-appear.md b/.changeset/curly-turkeys-appear.md new file mode 100644 index 00000000..67499226 --- /dev/null +++ b/.changeset/curly-turkeys-appear.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +fix: crash when using component and `{@const}` diff --git a/src/context/script-let.ts b/src/context/script-let.ts index a3d00798..9d62927c 100644 --- a/src/context/script-let.ts +++ b/src/context/script-let.ts @@ -423,7 +423,33 @@ export class ScriptLetContext { preparationScript?: string[]; }) ): void { - if (!params) { + let resolvedParams; + if (typeof params === "function") { + if (this.ctx.isTypeScript()) { + const generatedTypes = params({ + generateUniqueId: (base) => this.generateUniqueId(base), + }); + resolvedParams = [generatedTypes.param]; + if (generatedTypes.preparationScript) { + for (const preparationScript of generatedTypes.preparationScript) { + this.appendScriptWithoutOffset( + preparationScript, + (node, tokens, comments, result) => { + tokens.length = 0; + comments.length = 0; + removeAllScopeAndVariableAndReference(node, result); + } + ); + } + } + } else { + const generatedTypes = params(null); + resolvedParams = [generatedTypes.param]; + } + } else { + resolvedParams = params; + } + if (!resolvedParams || resolvedParams.length === 0) { const restore = this.appendScript( `{`, block.range[0], @@ -442,32 +468,6 @@ export class ScriptLetContext { ); this.pushScope(restore, "}"); } else { - let resolvedParams; - if (typeof params === "function") { - if (this.ctx.isTypeScript()) { - const generatedTypes = params({ - generateUniqueId: (base) => this.generateUniqueId(base), - }); - resolvedParams = [generatedTypes.param]; - if (generatedTypes.preparationScript) { - for (const preparationScript of generatedTypes.preparationScript) { - this.appendScriptWithoutOffset( - preparationScript, - (node, tokens, comments, result) => { - tokens.length = 0; - comments.length = 0; - removeAllScopeAndVariableAndReference(node, result); - } - ); - } - } - } else { - const generatedTypes = params(null); - resolvedParams = [generatedTypes.param]; - } - } else { - resolvedParams = params; - } const sortedParams = [...resolvedParams] .map((d) => { return { diff --git a/tests/fixtures/parser/ast/at-const01-within-component-input.svelte b/tests/fixtures/parser/ast/at-const01-within-component-input.svelte new file mode 100644 index 00000000..794ac271 --- /dev/null +++ b/tests/fixtures/parser/ast/at-const01-within-component-input.svelte @@ -0,0 +1,8 @@ + + + {@const a = b * 2} + {a} + diff --git a/tests/fixtures/parser/ast/at-const01-within-component-output.json b/tests/fixtures/parser/ast/at-const01-within-component-output.json new file mode 100644 index 00000000..19c0f35d --- /dev/null +++ b/tests/fixtures/parser/ast/at-const01-within-component-output.json @@ -0,0 +1,1198 @@ +{ + "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": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'./Component.svelte'", + "value": "./Component.svelte", + "range": [ + 33, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 11, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "raw": "42", + "value": 42, + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + ], + "range": [ + 56, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "range": [ + 0, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Component", + "range": [ + 80, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 79, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n ", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "SvelteConstTag", + "declaration": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "init": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 101, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 93, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "SvelteText", + "value": "\n ", + "range": [ + 111, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "range": [ + 114, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 8, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 118, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + "range": [ + 79, + 130 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + } + } + ], + "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": "import", + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "String", + "value": "'./Component.svelte'", + "range": [ + 33, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Component", + "range": [ + 80, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@const", + "range": [ + 94, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 111, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "Component", + "range": [ + 120, + 129 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + } + } + } + ], + "range": [ + 0, + 131 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/at-const01-within-component-scope-output.json b/tests/fixtures/parser/ast/at-const01-within-component-scope-output.json new file mode 100644 index 00000000..160b8416 --- /dev/null +++ b/tests/fixtures/parser/ast/at-const01-within-component-scope-output.json @@ -0,0 +1,810 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Component", + "identifiers": [ + { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "node": { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Component", + "range": [ + 80, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "raw": "42", + "value": 42, + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Component", + "range": [ + 80, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Component", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "init": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 101, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "block", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "block", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + } + ] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file