diff --git a/src/parser/index.ts b/src/parser/index.ts index c2be058f..6257a0fb 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -8,7 +8,11 @@ import { parseScript } from "./script" import type * as SvAST from "./svelte-ast-types" import { sort } from "./sort" import { parseTemplate } from "./template" -import { analyzePropsScope, analyzeStoreScope } from "./analyze-scope" +import { + analyzePropsScope, + analyzeReactiveScope, + analyzeStoreScope, +} from "./analyze-scope" import { ParseError } from "../errors" export interface ESLintProgram extends Program { @@ -71,6 +75,7 @@ export function parseForESLint( sort(ctx.tokens) extractTokens(ctx) analyzeStoreScope(resultScript.scopeManager!) + analyzeReactiveScope(resultScript.scopeManager!) // Add $$xxx variable for (const $$name of ["$$slots", "$$props", "$$restProps"]) { diff --git a/src/parser/script.ts b/src/parser/script.ts index 12da98f8..14db8faa 100644 --- a/src/parser/script.ts +++ b/src/parser/script.ts @@ -1,5 +1,5 @@ import type { ESLintExtendedProgram } from "." -import { analyzeReactiveScope, analyzeScope } from "./analyze-scope" +import { analyzeScope } from "./analyze-scope" import { traverseNodes } from "../traverse" import type { ScriptsSourceCode } from "../context" import { getParser } from "./resolve-parser" @@ -34,7 +34,6 @@ export function parseScript( // }, }) - analyzeReactiveScope(result.scopeManager) return result } diff --git a/tests/fixtures/parser/ast/reactive-with-var01-input.svelte b/tests/fixtures/parser/ast/reactive-with-var01-input.svelte new file mode 100644 index 00000000..b3eeebc7 --- /dev/null +++ b/tests/fixtures/parser/ast/reactive-with-var01-input.svelte @@ -0,0 +1,18 @@ + + +

$count: {$count}

+

$count2: {$count2}

+

foo: {foo}

+

$bar: {$bar}

+

baz: {baz}

+ diff --git a/tests/fixtures/parser/ast/reactive-with-var01-output.json b/tests/fixtures/parser/ast/reactive-with-var01-output.json new file mode 100644 index 00000000..96a456ab --- /dev/null +++ b/tests/fixtures/parser/ast/reactive-with-var01-output.json @@ -0,0 +1,4708 @@ +{ + "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": "'./stores.js'", + "value": "./stores.js", + "range": [ + 40, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "local": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "local": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 10, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'svelte/store'", + "value": "svelte/store", + "range": [ + 81, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "local": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "range": [ + 56, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "init": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 104, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + ], + "range": [ + 100, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "writable", + "range": [ + 123, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 123, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "range": [ + 117, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 113, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "SvelteReactiveStatement", + "label": { + "type": "Identifier", + "name": "$", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "$count2", + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "operator": "=", + "right": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "$count", + "range": [ + 149, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 149, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 139, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 139, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 136, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "SvelteReactiveStatement", + "label": { + "type": "Identifier", + "name": "$", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 164, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "$count", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "3", + "value": 3, + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "range": [ + 170, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "range": [ + 164, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "range": [ + 164, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "range": [ + 161, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "SvelteReactiveStatement", + "label": { + "type": "Identifier", + "name": "$", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "$bar", + "range": [ + 185, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "operator": "=", + "right": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "$count", + "range": [ + 192, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "4", + "value": 4, + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 192, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 185, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 185, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 182, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "SvelteReactiveStatement", + "label": { + "type": "Identifier", + "name": "$", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "5", + "value": 5, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 213, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 207, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 207, + 243 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 40 + } + } + }, + "range": [ + 204, + 243 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 40 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 244, + 253 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 0, + 253 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 253, + 255 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "h1", + "range": [ + 256, + 258 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 255, + 259 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "$count: ", + "range": [ + 259, + 267 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "$count", + "range": [ + 268, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "range": [ + 267, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 20 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 275, + 280 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "range": [ + 255, + 280 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "h1", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 281, + 285 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "$count2: ", + "range": [ + 285, + 294 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "$count2", + "range": [ + 295, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + "range": [ + 294, + 303 + ], + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 22 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 303, + 308 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "range": [ + 281, + 308 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "h1", + "range": [ + 310, + 312 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 309, + 313 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "foo: ", + "range": [ + 313, + 318 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "foo", + "range": [ + 319, + 322 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + "range": [ + 318, + 323 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 323, + 328 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "range": [ + 309, + 328 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 328, + 329 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "h1", + "range": [ + 330, + 332 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 329, + 333 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "$bar: ", + "range": [ + 333, + 339 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "$bar", + "range": [ + 340, + 344 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + "range": [ + 339, + 345 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 345, + 350 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + "range": [ + 329, + 350 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "h1", + "range": [ + 352, + 354 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 351, + 355 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "baz: ", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "baz", + "range": [ + 361, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "range": [ + 360, + 365 + ], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 365, + 370 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + "range": [ + 351, + 370 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 372, + 378 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 382, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 379, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 393, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 389, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + "range": [ + 379, + 402 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 31 + } + } + } + ], + "selfClosing": false, + "range": [ + 371, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 32 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "+1", + "range": [ + 403, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 34 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 405, + 414 + ], + "loc": { + "start": { + "line": 18, + "column": 34 + }, + "end": { + "line": 18, + "column": 43 + } + } + }, + "range": [ + 371, + 414 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 43 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " ComputedVariable", + "range": [ + 224, + 243 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 40 + } + } + } + ], + "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": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "String", + "value": "'./stores.js'", + "range": [ + 40, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 56, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "String", + "value": "'svelte/store'", + "range": [ + 81, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 100, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "writable", + "range": [ + 123, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "$", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "$count2", + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 149, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "$", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 164, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "$", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "$bar", + "range": [ + 185, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 192, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "$", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 246, + 252 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 253, + 255 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 256, + 258 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "$count:", + "range": [ + 259, + 266 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 268, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 277, + 279 + ], + "loc": { + "start": { + "line": 13, + "column": 22 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "$count2:", + "range": [ + 285, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "$count2", + "range": [ + 295, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 302, + 303 + ], + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 303, + 304 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 305, + 307 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 307, + 308 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 310, + 312 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 312, + 313 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "foo:", + "range": [ + 313, + 317 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 317, + 318 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 318, + 319 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 319, + 322 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 323, + 324 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 325, + 327 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 327, + 328 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 328, + 329 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 329, + 330 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 330, + 332 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "$bar:", + "range": [ + 333, + 338 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "$bar", + "range": [ + 340, + 344 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 344, + 345 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 346, + 347 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 347, + 349 + ], + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 352, + 354 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 354, + 355 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "baz:", + "range": [ + 355, + 359 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 361, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 364, + 365 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 365, + 366 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 366, + 367 + ], + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "h1", + "range": [ + 367, + 369 + ], + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 371, + 372 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 372, + 378 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 379, + 381 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 381, + 382 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 382, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 387, + 388 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 388, + 389 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 389, + 390 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 390, + 391 + ], + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 391, + 393 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 399, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 28 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 401, + 402 + ], + "loc": { + "start": { + "line": 18, + "column": 30 + }, + "end": { + "line": 18, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 402, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 31 + }, + "end": { + "line": 18, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "+1", + "range": [ + 403, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 18, + "column": 34 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 18, + "column": 35 + }, + "end": { + "line": 18, + "column": 36 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 407, + 413 + ], + "loc": { + "start": { + "line": 18, + "column": 36 + }, + "end": { + "line": 18, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 18, + "column": 42 + }, + "end": { + "line": 18, + "column": 43 + } + } + } + ], + "range": [ + 0, + 415 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 19, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/reactive-with-var01-prefer-const-result.json b/tests/fixtures/parser/ast/reactive-with-var01-prefer-const-result.json new file mode 100644 index 00000000..066960bb --- /dev/null +++ b/tests/fixtures/parser/ast/reactive-with-var01-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "bar", + "line": 6, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/reactive-with-var01-scope-output.json b/tests/fixtures/parser/ast/reactive-with-var01-scope-output.json new file mode 100644 index 00000000..ba528acd --- /dev/null +++ b/tests/fixtures/parser/ast/reactive-with-var01-scope-output.json @@ -0,0 +1,2370 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "local": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 149, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 192, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 268, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 192, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 268, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ] + }, + { + "name": "count2", + "identifiers": [ + { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "local": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$count2", + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count2", + "range": [ + 295, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count2", + "range": [ + 295, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ] + }, + { + "name": "writable", + "identifiers": [ + { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "local": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "writable", + "range": [ + 123, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + } + ] + }, + { + "name": "foo", + "identifiers": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "init": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 104, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 164, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 319, + 322 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + } + ] + }, + { + "name": "bar", + "identifiers": [ + { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "writable", + "range": [ + 123, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 123, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "range": [ + 117, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$bar", + "range": [ + 185, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$bar", + "range": [ + 340, + 344 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$bar", + "range": [ + 340, + 344 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + } + ] + }, + { + "name": "baz", + "identifiers": [ + { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + ], + "defs": [ + { + "type": "ComputedVariable", + "name": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "node": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "5", + "value": 5, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 213, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 207, + 223 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 20 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "baz", + "range": [ + 361, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "writable", + "range": [ + 123, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "writable", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count2", + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 149, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 164, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$bar", + "range": [ + 185, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 192, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 213, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 268, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$count2", + "range": [ + 295, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count2", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 319, + 322 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$bar", + "range": [ + 340, + 344 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 117, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "baz", + "range": [ + 361, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "baz", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$count", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file