diff --git a/.changeset/sharp-kangaroos-tease.md b/.changeset/sharp-kangaroos-tease.md new file mode 100644 index 00000000..f46f214e --- /dev/null +++ b/.changeset/sharp-kangaroos-tease.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +feat: add `$state.frozen` support diff --git a/package.json b/package.json index 2df8e531..c2414270 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "prettier-plugin-svelte": "^3.1.2", "rimraf": "^5.0.5", "semver": "^7.5.4", - "svelte": "^5.0.0-next.25", + "svelte": "^5.0.0-next.37", "svelte2tsx": "^0.7.0", "typescript": "~5.1.6", "typescript-eslint-parser-for-extra-files": "^0.6.0" diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index 6db90a46..522dd2ed 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -318,6 +318,10 @@ function analyzeRuneVariables( "(initial: T): T", "(): T | undefined", ]); + appendDeclareNamespaceVirtualScripts(globalName, [ + "export function frozen(initial: T): Readonly;", + "export function frozen(): Readonly | undefined;", + ]); break; } case "$derived": { diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-input.svelte new file mode 100644 index 00000000..ecee83d8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-input.svelte @@ -0,0 +1,15 @@ + + + + + + +

+ {numbers.join(" + ") || 0} + = + {numbers.reduce((a, b) => a + b, 0)} +

diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-output.json new file mode 100644 index 00000000..a662a801 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-output.json @@ -0,0 +1,3908 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Literal", + "raw": "3", + "value": 3, + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "range": [ + 39, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 25, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 15, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + ], + "range": [ + 11, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 51, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 60, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 63, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "numbers", + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "numbers", + "range": [ + 101, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "range": [ + 98, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 36 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 110, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 118, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 56 + }, + "end": { + "line": 5, + "column": 62 + } + } + }, + "range": [ + 110, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 62 + } + } + }, + "operator": "+", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 65 + }, + "end": { + "line": 5, + "column": 66 + } + } + }, + "range": [ + 110, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 66 + } + } + } + ], + "range": [ + 97, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 67 + } + } + }, + "range": [ + 87, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 67 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 80, + 130 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 68 + } + } + }, + "range": [ + 79, + 131 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 69 + } + } + } + ], + "range": [ + 70, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 70 + } + } + } + ], + "selfClosing": false, + "range": [ + 62, + 133 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 71 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n push\n", + "range": [ + 133, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 71 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 141, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 62, + 150 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 150, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 153, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "numbers", + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "operator": "=", + "right": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 49 + }, + "end": { + "line": 9, + "column": 50 + } + } + }, + { + "type": "UnaryExpression", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 53 + }, + "end": { + "line": 9, + "column": 54 + } + } + }, + "operator": "-", + "prefix": true, + "range": [ + 204, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 52 + }, + "end": { + "line": 9, + "column": 54 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 187, + 194 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "slice", + "range": [ + 195, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 43 + }, + "end": { + "line": 9, + "column": 48 + } + } + }, + "range": [ + 187, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 48 + } + } + }, + "optional": false, + "range": [ + 187, + 207 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 55 + } + } + }, + "range": [ + 177, + 207 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 55 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 170, + 208 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 56 + } + } + }, + "range": [ + 169, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 57 + } + } + } + ], + "range": [ + 160, + 210 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 58 + } + } + } + ], + "selfClosing": false, + "range": [ + 152, + 211 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 59 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": " pop ", + "range": [ + 211, + 216 + ], + "loc": { + "start": { + "line": 9, + "column": 59 + }, + "end": { + "line": 9, + "column": 64 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 216, + 225 + ], + "loc": { + "start": { + "line": 9, + "column": 64 + }, + "end": { + "line": 9, + "column": 73 + } + } + }, + "range": [ + 152, + 225 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 73 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 225, + 227 + ], + "loc": { + "start": { + "line": 9, + "column": 73 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 227, + 230 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n ", + "range": [ + 230, + 233 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "LogicalExpression", + "left": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\" + \"", + "value": " + ", + "range": [ + 247, + 252 + ], + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 21 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "join", + "range": [ + 242, + 246 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + "range": [ + 234, + 246 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 234, + 253 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + "operator": "||", + "right": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "range": [ + 234, + 258 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "range": [ + 233, + 259 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": "SvelteText", + "value": "\n =\n ", + "range": [ + 259, + 266 + ], + "loc": { + "start": { + "line": 12, + "column": 28 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "range": [ + 292, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "range": [ + 282, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 14, + "column": 35 + }, + "end": { + "line": 14, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "reduce", + "range": [ + 275, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + "range": [ + 267, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + "optional": false, + "range": [ + 267, + 301 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 37 + } + } + }, + "range": [ + 266, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 38 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 302, + 303 + ], + "loc": { + "start": { + "line": 14, + "column": 38 + }, + "end": { + "line": 15, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 303, + 307 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "range": [ + 227, + 307 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 15, + "column": 4 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "frozen", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 60, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 63, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 83, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 98, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 36 + }, + "end": { + "line": 5, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 101, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 46 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 110, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 55 + }, + "end": { + "line": 5, + "column": 56 + } + } + }, + { + "type": "Identifier", + "value": "length", + "range": [ + 118, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 56 + }, + "end": { + "line": 5, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 63 + }, + "end": { + "line": 5, + "column": 64 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 65 + }, + "end": { + "line": 5, + "column": 66 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 66 + }, + "end": { + "line": 5, + "column": 67 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 5, + "column": 67 + }, + "end": { + "line": 5, + "column": 68 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 5, + "column": 68 + }, + "end": { + "line": 5, + "column": 69 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 69 + }, + "end": { + "line": 5, + "column": 70 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 5, + "column": 70 + }, + "end": { + "line": 5, + "column": 71 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 5, + "column": 71 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "push", + "range": [ + 136, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 143, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 150, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 153, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 173, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 33 + }, + "end": { + "line": 9, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 187, + 194 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 42 + }, + "end": { + "line": 9, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "slice", + "range": [ + 195, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 43 + }, + "end": { + "line": 9, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 9, + "column": 48 + }, + "end": { + "line": 9, + "column": 49 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 49 + }, + "end": { + "line": 9, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 9, + "column": 50 + }, + "end": { + "line": 9, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 52 + }, + "end": { + "line": 9, + "column": 53 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 53 + }, + "end": { + "line": 9, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 9, + "column": 54 + }, + "end": { + "line": 9, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 9, + "column": 55 + }, + "end": { + "line": 9, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 56 + }, + "end": { + "line": 9, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 9, + "column": 57 + }, + "end": { + "line": 9, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 9, + "column": 58 + }, + "end": { + "line": 9, + "column": 59 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 9, + "column": 59 + }, + "end": { + "line": 9, + "column": 60 + } + } + }, + { + "type": "HTMLText", + "value": "pop", + "range": [ + 212, + 215 + ], + "loc": { + "start": { + "line": 9, + "column": 60 + }, + "end": { + "line": 9, + "column": 63 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 9, + "column": 63 + }, + "end": { + "line": 9, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 9, + "column": 64 + }, + "end": { + "line": 9, + "column": 65 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 9, + "column": 65 + }, + "end": { + "line": 9, + "column": 66 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 218, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 66 + }, + "end": { + "line": 9, + "column": 72 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 9, + "column": 72 + }, + "end": { + "line": 9, + "column": 73 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 225, + 227 + ], + "loc": { + "start": { + "line": 9, + "column": 73 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 230, + 233 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "join", + "range": [ + 242, + 246 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "String", + "value": "\" + \"", + "range": [ + 247, + 252 + ], + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 254, + 256 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 259, + 262 + ], + "loc": { + "start": { + "line": 12, + "column": 28 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 263, + 266 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "reduce", + "range": [ + 275, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 14, + "column": 20 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 289, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 14, + "column": 33 + }, + "end": { + "line": 14, + "column": 34 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 14, + "column": 35 + }, + "end": { + "line": 14, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 14, + "column": 36 + }, + "end": { + "line": 14, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 301, + 302 + ], + "loc": { + "start": { + "line": 14, + "column": 37 + }, + "end": { + "line": 14, + "column": 38 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 302, + 303 + ], + "loc": { + "start": { + "line": 14, + "column": 38 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 303, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 305, + 306 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + } + ], + "range": [ + 0, + 308 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 16, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json new file mode 100644 index 00000000..6ff87735 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json @@ -0,0 +1,1721 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "numbers", + "identifiers": [ + { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Literal", + "raw": "3", + "value": 3, + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "range": [ + 39, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 25, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 15, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 101, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 110, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 187, + 194 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 101, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 110, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 101, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 110, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 187, + 194 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 187, + 194 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "range": [ + 292, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "range": [ + 282, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "range": [ + 292, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "range": [ + 282, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-input.svelte b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-input.svelte new file mode 100644 index 00000000..4d440c21 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-input.svelte @@ -0,0 +1,16 @@ + + + + + + +

+ {numbers.join(" + ") || 0} + = + {numbers.reduce((a, b) => a + b, 0)} +

diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-no-unused-vars-result.json new file mode 100644 index 00000000..1f43fde5 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "unused", + "line": 3, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-output.json b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-output.json new file mode 100644 index 00000000..1bd31be8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-output.json @@ -0,0 +1,4549 @@ +{ + "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": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Literal", + "raw": "3", + "value": 3, + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "range": [ + 49, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 35, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 25, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + ], + "range": [ + 21, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "\"a\"", + "value": "a", + "range": [ + 91, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Literal", + "raw": "\"b\"", + "value": "b", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": "Literal", + "raw": "\"c\"", + "value": "c", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 43 + } + } + } + ], + "range": [ + 90, + 105 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 83, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "range": [ + 76, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 76, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 67, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 45 + } + } + } + ], + "range": [ + 63, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 108, + 117 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "range": [ + 0, + 117 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 117, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "numbers", + "range": [ + 144, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "numbers", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 155, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 167, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 55 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 175, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 56 + }, + "end": { + "line": 6, + "column": 62 + } + } + }, + "range": [ + 167, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 62 + } + } + }, + "operator": "+", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 65 + }, + "end": { + "line": 6, + "column": 66 + } + } + }, + "range": [ + 167, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 66 + } + } + } + ], + "range": [ + 154, + 186 + ], + "loc": { + "start": { + "line": 6, + "column": 35 + }, + "end": { + "line": 6, + "column": 67 + } + } + }, + "range": [ + 144, + 186 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 67 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 137, + 187 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 68 + } + } + }, + "range": [ + 136, + 188 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 69 + } + } + } + ], + "range": [ + 127, + 189 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 70 + } + } + } + ], + "selfClosing": false, + "range": [ + 119, + 190 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 71 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n push\n", + "range": [ + 190, + 198 + ], + "loc": { + "start": { + "line": 6, + "column": 71 + }, + "end": { + "line": 8, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 198, + 207 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "range": [ + 119, + 207 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 207, + 209 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + "operator": "=", + "right": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 10, + "column": 49 + }, + "end": { + "line": 10, + "column": 50 + } + } + }, + { + "type": "UnaryExpression", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 53 + }, + "end": { + "line": 10, + "column": 54 + } + } + }, + "operator": "-", + "prefix": true, + "range": [ + 261, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 52 + }, + "end": { + "line": 10, + "column": 54 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 244, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "slice", + "range": [ + 252, + 257 + ], + "loc": { + "start": { + "line": 10, + "column": 43 + }, + "end": { + "line": 10, + "column": 48 + } + } + }, + "range": [ + 244, + 257 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 48 + } + } + }, + "optional": false, + "range": [ + 244, + 264 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 55 + } + } + }, + "range": [ + 234, + 264 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 55 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 227, + 265 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 56 + } + } + }, + "range": [ + 226, + 266 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 57 + } + } + } + ], + "range": [ + 217, + 267 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 58 + } + } + } + ], + "selfClosing": false, + "range": [ + 209, + 268 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 59 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": " pop ", + "range": [ + 268, + 273 + ], + "loc": { + "start": { + "line": 10, + "column": 59 + }, + "end": { + "line": 10, + "column": 64 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 273, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 64 + }, + "end": { + "line": 10, + "column": 73 + } + } + }, + "range": [ + 209, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 73 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 10, + "column": 73 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 285, + 286 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 284, + 287 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n ", + "range": [ + 287, + 290 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "LogicalExpression", + "left": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\" + \"", + "value": " + ", + "range": [ + 304, + 309 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 21 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 291, + 298 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "join", + "range": [ + 299, + 303 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 291, + 303 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 291, + 310 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + "operator": "||", + "right": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "range": [ + 291, + 315 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "range": [ + 290, + 316 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": "SvelteText", + "value": "\n =\n ", + "range": [ + 316, + 323 + ], + "loc": { + "start": { + "line": 13, + "column": 28 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "range": [ + 349, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "range": [ + 339, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 15, + "column": 35 + }, + "end": { + "line": 15, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "numbers", + "range": [ + 324, + 331 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "reduce", + "range": [ + 332, + 338 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "range": [ + 324, + 338 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "optional": false, + "range": [ + 324, + 358 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 37 + } + } + }, + "range": [ + 323, + 359 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 38 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 15, + "column": 38 + }, + "end": { + "line": 16, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + "range": [ + 284, + 364 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 16, + "column": 4 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "frozen", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 63, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "frozen", + "range": [ + 83, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "String", + "value": "\"a\"", + "range": [ + 91, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "String", + "value": "\"b\"", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + { + "type": "String", + "value": "\"c\"", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 44 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 45 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 117, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 138, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 140, + 142 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 144, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 6, + "column": 35 + }, + "end": { + "line": 6, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 155, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 6, + "column": 46 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 167, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 6, + "column": 55 + }, + "end": { + "line": 6, + "column": 56 + } + } + }, + { + "type": "Identifier", + "value": "length", + "range": [ + 175, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 56 + }, + "end": { + "line": 6, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 6, + "column": 63 + }, + "end": { + "line": 6, + "column": 64 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 65 + }, + "end": { + "line": 6, + "column": 66 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 6, + "column": 66 + }, + "end": { + "line": 6, + "column": 67 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 6, + "column": 67 + }, + "end": { + "line": 6, + "column": 68 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 6, + "column": 68 + }, + "end": { + "line": 6, + "column": 69 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 6, + "column": 69 + }, + "end": { + "line": 6, + "column": 70 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 6, + "column": 70 + }, + "end": { + "line": 6, + "column": 71 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 190, + 193 + ], + "loc": { + "start": { + "line": 6, + "column": 71 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "push", + "range": [ + 193, + 197 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 200, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 207, + 209 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 230, + 232 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 10, + "column": 33 + }, + "end": { + "line": 10, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 244, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "slice", + "range": [ + 252, + 257 + ], + "loc": { + "start": { + "line": 10, + "column": 43 + }, + "end": { + "line": 10, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 10, + "column": 48 + }, + "end": { + "line": 10, + "column": 49 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 10, + "column": 49 + }, + "end": { + "line": 10, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 10, + "column": 50 + }, + "end": { + "line": 10, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 10, + "column": 52 + }, + "end": { + "line": 10, + "column": 53 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 53 + }, + "end": { + "line": 10, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 10, + "column": 54 + }, + "end": { + "line": 10, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 10, + "column": 55 + }, + "end": { + "line": 10, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 10, + "column": 56 + }, + "end": { + "line": 10, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 10, + "column": 57 + }, + "end": { + "line": 10, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 10, + "column": 58 + }, + "end": { + "line": 10, + "column": 59 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 10, + "column": 59 + }, + "end": { + "line": 10, + "column": 60 + } + } + }, + { + "type": "HTMLText", + "value": "pop", + "range": [ + 269, + 272 + ], + "loc": { + "start": { + "line": 10, + "column": 60 + }, + "end": { + "line": 10, + "column": 63 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 10, + "column": 63 + }, + "end": { + "line": 10, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 10, + "column": 64 + }, + "end": { + "line": 10, + "column": 65 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 10, + "column": 65 + }, + "end": { + "line": 10, + "column": 66 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 275, + 281 + ], + "loc": { + "start": { + "line": 10, + "column": 66 + }, + "end": { + "line": 10, + "column": 72 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 72 + }, + "end": { + "line": 10, + "column": 73 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 10, + "column": 73 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 285, + 286 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 287, + 290 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 291, + 298 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 298, + 299 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "join", + "range": [ + 299, + 303 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 303, + 304 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "String", + "value": "\" + \"", + "range": [ + 304, + 309 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 311, + 313 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 315, + 316 + ], + "loc": { + "start": { + "line": 13, + "column": 27 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 13, + "column": 28 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 319, + 320 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "\n ", + "range": [ + 320, + 323 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 323, + 324 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "numbers", + "range": [ + 324, + 331 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "reduce", + "range": [ + 332, + 338 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 344, + 345 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 346, + 348 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 354, + 355 + ], + "loc": { + "start": { + "line": 15, + "column": 33 + }, + "end": { + "line": 15, + "column": 34 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 15, + "column": 35 + }, + "end": { + "line": 15, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 357, + 358 + ], + "loc": { + "start": { + "line": 15, + "column": 36 + }, + "end": { + "line": 15, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 358, + 359 + ], + "loc": { + "start": { + "line": 15, + "column": 37 + }, + "end": { + "line": 15, + "column": 38 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 15, + "column": 38 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 362, + 363 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 363, + 364 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + } + ], + "range": [ + 0, + 365 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 17, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-prefer-const-result.json new file mode 100644 index 00000000..6b3682d9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "unused", + "line": 3, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json new file mode 100644 index 00000000..6398f48f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json @@ -0,0 +1,2104 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "numbers", + "identifiers": [ + { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Literal", + "raw": "3", + "value": 3, + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "range": [ + 49, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 35, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 25, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 144, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 167, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 244, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 291, + 298 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 324, + 331 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "name": "unused", + "identifiers": [ + { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "raw": "\"a\"", + "value": "a", + "range": [ + 91, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Literal", + "raw": "\"b\"", + "value": "b", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": "Literal", + "raw": "\"c\"", + "value": "c", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 43 + } + } + } + ], + "range": [ + 90, + 105 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "frozen", + "range": [ + 83, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "range": [ + 76, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 76, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 67, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 45 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "unused", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 291, + 298 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 324, + 331 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 144, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 167, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 144, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 167, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 55 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 244, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "numbers", + "range": [ + 244, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "numbers", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "range": [ + 349, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "range": [ + 339, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "range": [ + 349, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "range": [ + 339, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file