From 5f2b1112e1ceacfabb292e51d33492fba878bc6c Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Sun, 3 Mar 2024 13:28:00 +0900 Subject: [PATCH] feat: add experimental support for generics directive (#477) --- .changeset/twelve-bulldogs-peel.md | 5 + README.md | 18 + docs/AST.md | 14 + src/ast/html.ts | 9 + src/context/fix-locations.ts | 73 + src/context/index.ts | 57 +- src/context/script-let.ts | 253 +- src/parser/converts/root.ts | 127 + src/parser/parser-options.ts | 6 + src/parser/typescript/analyze/index.ts | 14 +- src/parser/typescript/index.ts | 2 +- src/visitor-keys.ts | 1 + .../snippets/10-typing-snippets-input.svelte | 22 + .../snippets/10-typing-snippets-output.json | 3908 ++++++++++++ ...0-typing-snippets-prefer-const-result.json | 20 + .../10-typing-snippets-scope-output.json | 3336 ++++++++++ .../10-typing-snippets-type-output.svelte | 22 + .../snippets/11-typing-snippets-input.svelte | 22 + .../snippets/11-typing-snippets-output.json | 4109 +++++++++++++ ...1-typing-snippets-prefer-const-result.json | 20 + .../11-typing-snippets-scope-output.json | 3690 +++++++++++ .../11-typing-snippets-type-output.svelte | 22 + .../svelte5/generics01-snippets-input.svelte | 23 + .../svelte5/generics01-snippets-output.json | 4251 +++++++++++++ ...nerics01-snippets-prefer-const-result.json | 20 + .../generics01-snippets-scope-output.json | 3888 ++++++++++++ .../generics01-snippets-type-output.svelte | 23 + .../parser/ast/ts-generics01-input.svelte | 9 + .../ts-generics01-no-unused-vars-result.json | 8 + .../parser/ast/ts-generics01-output.json | 2164 +++++++ .../ast/ts-generics01-scope-output.json | 2375 ++++++++ .../ast/ts-generics01-type-output.svelte | 9 + .../parser/ast/ts-generics02-input.svelte | 11 + .../parser/ast/ts-generics02-output.json | 1818 ++++++ .../ast/ts-generics02-scope-output.json | 1372 +++++ .../ast/ts-generics02-type-output.svelte | 11 + .../parser/ast/ts-generics03-input.svelte | 15 + .../parser/ast/ts-generics03-output.json | 2598 ++++++++ .../ast/ts-generics03-scope-output.json | 2571 ++++++++ .../ast/ts-generics03-type-output.svelte | 15 + .../ts-generics04-with-spaces-input.svelte | 21 + .../ast/ts-generics04-with-spaces-output.json | 2617 ++++++++ ...s-generics04-with-spaces-scope-output.json | 2571 ++++++++ ...-generics04-with-spaces-type-output.svelte | 21 + .../ts-generics05-with-spaces-input.svelte | 27 + .../ast/ts-generics05-with-spaces-output.json | 3135 ++++++++++ ...s-generics05-with-spaces-scope-output.json | 2840 +++++++++ ...-generics05-with-spaces-type-output.svelte | 27 + .../ast/ts-generics06-complex-input.svelte | 19 + .../ast/ts-generics06-complex-output.json | 5398 ++++++++++++++++ .../ts-generics06-complex-requirements.json | 5 + .../ts-generics06-complex-scope-output.json | 5419 +++++++++++++++++ .../ts-generics06-complex-type-output.svelte | 19 + .../ts-generics07-syntax-error-input.svelte | 11 + ...nerics07-syntax-error-no-undef-result.json | 14 + .../ts-generics07-syntax-error-output.json | 1965 ++++++ ...-generics07-syntax-error-scope-output.json | 2013 ++++++ ...generics07-syntax-error-type-output.svelte | 11 + tests/src/parser/test-utils.ts | 3 + tests/src/parser/typescript/index.ts | 7 +- tools/update-fixtures.ts | 13 +- 61 files changed, 62992 insertions(+), 95 deletions(-) create mode 100644 .changeset/twelve-bulldogs-peel.md create mode 100644 src/context/fix-locations.ts create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-type-output.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-type-output.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/generics01-snippets-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/generics01-snippets-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/generics01-snippets-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/generics01-snippets-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics01-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics01-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/ts-generics01-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics01-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics01-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics02-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics02-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics02-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics02-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics03-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics03-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics03-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics03-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics04-with-spaces-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics04-with-spaces-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics04-with-spaces-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics04-with-spaces-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics05-with-spaces-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics05-with-spaces-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics05-with-spaces-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics05-with-spaces-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics06-complex-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics06-complex-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics06-complex-requirements.json create mode 100644 tests/fixtures/parser/ast/ts-generics06-complex-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics06-complex-type-output.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics07-syntax-error-input.svelte create mode 100644 tests/fixtures/parser/ast/ts-generics07-syntax-error-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/ts-generics07-syntax-error-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics07-syntax-error-scope-output.json create mode 100644 tests/fixtures/parser/ast/ts-generics07-syntax-error-type-output.svelte diff --git a/.changeset/twelve-bulldogs-peel.md b/.changeset/twelve-bulldogs-peel.md new file mode 100644 index 00000000..2fae5d01 --- /dev/null +++ b/.changeset/twelve-bulldogs-peel.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add experimental support for generics directive diff --git a/README.md b/README.md index 717578b2..dbf44307 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,24 @@ module.exports = { } ``` +### parserOptions.svelteFeatures + +You can use `parserOptions.svelteFeatures` property to specify how to parse related to Svelte features. For example: + +```json +{ + "parser": "svelte-eslint-parser", + "parserOptions": { + "svelteFeatures": { + /* -- Experimental Svelte Features -- */ + // Whether to parse the `generics` attribute. + // See https://github.com/sveltejs/rfcs/pull/38 + "experimentalGenerics": false + } + } +} +``` + ### Runes support ***This is an experimental feature. It may be changed or removed in minor versions without notice.*** diff --git a/docs/AST.md b/docs/AST.md index 680820a9..a7066e01 100644 --- a/docs/AST.md +++ b/docs/AST.md @@ -172,6 +172,7 @@ interface SvelteStartTag extends Node { | SvelteDirective | SvelteStyleDirective | SvelteSpecialDirective + | SvelteGenericsDirective )[]; selfClosing: boolean; } @@ -362,6 +363,19 @@ interface SvelteSpecialDirectiveKey extends Node { } ``` +### SvelteGenericsDirective + +This is the generics directive node. + +```ts +interface SvelteGenericsDirective extends BaseNode { + type: "SvelteGenericsDirective"; + key: SvelteName & { name: "generics" }; + params: TSESTree.TSTypeParameter[]; + parent: SvelteStartTag & { parent: SvelteScriptElement }; +} +``` + ## Texts and Literals ### SvelteText diff --git a/src/ast/html.ts b/src/ast/html.ts index 221c0276..efbe8f85 100644 --- a/src/ast/html.ts +++ b/src/ast/html.ts @@ -1,4 +1,5 @@ import type ESTree from "estree"; +import type { TSESTree } from "@typescript-eslint/types"; import type { BaseNode } from "./base"; import type { Token, Comment } from "./common"; @@ -32,6 +33,7 @@ export type SvelteHTMLNode = | SvelteDirective | SvelteStyleDirective | SvelteSpecialDirective + | SvelteGenericsDirective | SvelteDirectiveKey | SvelteSpecialDirectiveKey | SvelteHTMLComment; @@ -142,6 +144,7 @@ export interface SvelteStartTag extends BaseNode { | SvelteDirective | SvelteStyleDirective | SvelteSpecialDirective + | SvelteGenericsDirective )[]; selfClosing: boolean; parent: SvelteElement | SvelteScriptElement | SvelteStyleElement; @@ -651,3 +654,9 @@ export interface SvelteSpecialDirective extends BaseNode { expression: ESTree.Expression; parent: SvelteStartTag /* & { parent: SvelteSpecialElement } */; } +export interface SvelteGenericsDirective extends BaseNode { + type: "SvelteGenericsDirective"; + key: SvelteName & { name: "generics" }; + params: TSESTree.TSTypeParameterDeclaration["params"]; + parent: SvelteStartTag /* & { parent: SvelteScriptElement } */; +} diff --git a/src/context/fix-locations.ts b/src/context/fix-locations.ts new file mode 100644 index 00000000..dd1154e1 --- /dev/null +++ b/src/context/fix-locations.ts @@ -0,0 +1,73 @@ +import type * as ESTree from "estree"; +import type { Comment, Locations, Token } from "../ast"; +import type { Context } from "."; +import { traverseNodes } from "../traverse"; + +/** Fix locations */ +export function fixLocations( + node: ESTree.Node, + tokens: Token[], + comments: Comment[], + offset: number, + visitorKeys: { [type: string]: string[] } | undefined, + ctx: Context, +): void { + if (offset === 0) { + return; + } + const traversed = new Set(); + traverseNodes(node, { + visitorKeys, + enterNode: (n) => { + if (traversed.has(n)) { + return; + } + traversed.add(n); + if (traversed.has(n.range)) { + if (!traversed.has(n.loc)) { + // However, `Node#loc` may not be shared. + const locs = ctx.getConvertLocation({ + start: n.range![0], + end: n.range![1], + }); + applyLocs(n, locs); + traversed.add(n.loc); + } + } else { + const start = n.range![0] + offset; + const end = n.range![1] + offset; + const locs = ctx.getConvertLocation({ start, end }); + applyLocs(n, locs); + traversed.add(n.range); + traversed.add(n.loc); + } + }, + leaveNode: Function.prototype as any, + }); + for (const t of tokens) { + const start = t.range[0] + offset; + const end = t.range[1] + offset; + const locs = ctx.getConvertLocation({ start, end }); + applyLocs(t, locs); + } + for (const t of comments) { + const start = t.range[0] + offset; + const end = t.range[1] + offset; + const locs = ctx.getConvertLocation({ start, end }); + applyLocs(t, locs); + } +} + +/** + * applyLocs + */ +function applyLocs(target: Locations | ESTree.Node, locs: Locations) { + target.loc = locs.loc; + target.range = locs.range; + if (typeof (target as any).start === "number") { + delete (target as any).start; + } + if (typeof (target as any).end === "number") { + delete (target as any).end; + } +} diff --git a/src/context/index.ts b/src/context/index.ts index d172d211..32d0fd8a 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -29,9 +29,12 @@ export class ScriptsSourceCode { public readonly attrs: Record; - private _separate = ""; - - private _appendScriptLets: string | null = null; + private _appendScriptLets: { + separate: string; + beforeSpaces: string; + render: string; + generics: string; + } | null = null; public separateIndexes: number[] = []; @@ -49,16 +52,28 @@ export class ScriptsSourceCode { if (this._appendScriptLets == null) { return this.raw; } - return this.trimmedRaw + this._separate + this._appendScriptLets; + return ( + this.trimmedRaw + + this._appendScriptLets.separate + + this._appendScriptLets.beforeSpaces + + this._appendScriptLets.render + + this._appendScriptLets.generics + ); } - public getCurrentVirtualCodeInfo(): { script: string; render: string } { + public getCurrentVirtualCodeInfo(): { + script: string; + render: string; + generics: string; + } { if (this._appendScriptLets == null) { - return { script: this.raw, render: "" }; + return { script: this.raw, render: "", generics: "" }; } return { - script: this.trimmedRaw + this._separate, - render: this._appendScriptLets, + script: this.trimmedRaw + this._appendScriptLets.separate, + render: + this._appendScriptLets.beforeSpaces + this._appendScriptLets.render, + generics: this._appendScriptLets.generics, }; } @@ -68,22 +83,30 @@ export class ScriptsSourceCode { } return ( this.trimmedRaw.length + - this._separate.length + - this._appendScriptLets.length + this._appendScriptLets.separate.length + + this._appendScriptLets.beforeSpaces.length + + this._appendScriptLets.render.length + + this._appendScriptLets.generics.length ); } - public addLet(letCode: string): { start: number; end: number } { + public addLet( + letCode: string, + kind: "generics" | "render", + ): { start: number; end: number } { if (this._appendScriptLets == null) { - this._appendScriptLets = ""; - const currentLength = this.getCurrentVirtualCodeLength(); + const currentLength = this.trimmedRaw.length; this.separateIndexes = [currentLength, currentLength + 1]; - this._separate += "\n;"; - const after = this.raw.slice(this.getCurrentVirtualCodeLength()); - this._appendScriptLets += after; + const after = this.raw.slice(currentLength + 2); + this._appendScriptLets = { + separate: "\n;", + beforeSpaces: after, + render: "", + generics: "", + }; } const start = this.getCurrentVirtualCodeLength(); - this._appendScriptLets += letCode; + this._appendScriptLets[kind] += letCode; return { start, end: this.getCurrentVirtualCodeLength(), diff --git a/src/context/script-let.ts b/src/context/script-let.ts index 88b88635..d5718448 100644 --- a/src/context/script-let.ts +++ b/src/context/script-let.ts @@ -5,7 +5,6 @@ import type { Scope as TSScope } from "@typescript-eslint/scope-manager"; import type { Context, ScriptsSourceCode } from "."; import type { Comment, - Locations, SvelteEachBlock, SvelteIfBlock, SvelteName, @@ -18,11 +17,13 @@ import { getWithLoc } from "../parser/converts/common"; import { getScopeFromNode, removeAllScopeAndVariableAndReference, + removeIdentifierVariable, removeReference, removeScope, } from "../scope"; import { getKeys, traverseNodes, getNodes } from "../traverse"; import { UniqueIdGenerator } from "./unique"; +import { fixLocations } from "./fix-locations"; type TSAsExpression = { type: "TSAsExpression"; @@ -163,6 +164,7 @@ export class ScriptLetContext { this.appendScript( `(${part})${isTS ? `as (${typing})` : ""};`, range[0] - 1, + "render", (st, tokens, comments, result) => { const exprSt = st as ESTree.ExpressionStatement; const tsAs: TSAsExpression | null = isTS @@ -218,6 +220,7 @@ export class ScriptLetContext { this.appendScript( `({${part}});`, range[0] - 2, + "render", (st, tokens, _comments, result) => { const exprSt = st as ESTree.ExpressionStatement; const objectExpression: ESTree.ObjectExpression = @@ -252,6 +255,7 @@ export class ScriptLetContext { this.appendScript( `const ${part};`, range[0] - 6, + "render", (st, tokens, _comments, result) => { const decl = st as ESTree.VariableDeclaration; const node = decl.declarations[0]; @@ -281,6 +285,100 @@ export class ScriptLetContext { return callbacks; } + public addGenericTypeAliasDeclaration( + param: TSESTree.TSTypeParameter, + callbackId: (id: TSESTree.Identifier, type: TSESTree.TypeNode) => void, + callbackDefault: (type: TSESTree.TypeNode) => void, + ): void { + const ranges = getTypeParameterRanges(this.ctx.code, param); + let scriptLet = `type ${this.ctx.code.slice(...ranges.idRange)}`; + if (ranges.constraintRange) { + scriptLet += ` = ${this.ctx.code.slice(...ranges.constraintRange)};`; + // |extends| + } else { + scriptLet += " = unknown;"; + } + + this.appendScript( + scriptLet, + ranges.idRange[0] - 5, + "generics", + (st, tokens, _comments, result) => { + const decl = st as any as TSESTree.TSTypeAliasDeclaration; + const id = decl.id; + const typeAnnotation = decl.typeAnnotation; + // Process for nodes + callbackId(id, typeAnnotation); + + const scope = result.getScope(decl as any); + for (const variable of scope.variables) { + for (const def of variable.defs) { + if (def.node === decl) { + def.node = param; + } + } + } + + (id as any).parent = param; + (typeAnnotation as any).parent = param; + + tokens.shift(); // type + if (ranges.constraintRange) { + const eqToken = tokens[1]; + eqToken.type = "Keyword"; + eqToken.value = "extends"; + eqToken.range[0] = eqToken.range[0] - 1; + eqToken.range[1] = eqToken.range[0] + 7; + tokens.pop(); // ; + } else { + tokens.pop(); // ; + tokens.pop(); // unknown + tokens.pop(); // = + } + + // Disconnect the tree structure. + delete (decl as any).id; + delete (decl as any).typeAnnotation; + delete (decl as any).typeParameters; + }, + ); + + if (ranges.defaultRange) { + const eqDefaultType = this.ctx.code.slice( + ranges.constraintRange?.[1] ?? ranges.idRange[1], + ranges.defaultRange[1], + ); + const id = this.generateUniqueId(eqDefaultType); + const scriptLet = `type ${id}${eqDefaultType};`; + + this.appendScript( + scriptLet, + ranges.defaultRange[0] - 5 - id.length - 1, + "generics", + (st, tokens, _comments, result) => { + const decl = st as any as TSESTree.TSTypeAliasDeclaration; + const typeAnnotation = decl.typeAnnotation; + // Process for nodes + callbackDefault(typeAnnotation); + + const scope = result.getScope(decl as any); + removeIdentifierVariable(decl.id, scope); + + (typeAnnotation as any).parent = param; + + tokens.shift(); // type + tokens.shift(); // ${id} + tokens.pop(); // ; + + // Disconnect the tree structure. + delete (decl as any).id; + delete (decl as any).typeAnnotation; + delete (decl as any).typeParameters; + }, + ); + } + } + public nestIfBlock( expression: ESTree.Expression, ifBlock: SvelteIfBlock, @@ -291,6 +389,7 @@ export class ScriptLetContext { const restore = this.appendScript( `if(${part}){`, range[0] - 3, + "render", (st, tokens, _comments, result) => { const ifSt = st as ESTree.IfStatement; const node = ifSt.test; @@ -345,6 +444,7 @@ export class ScriptLetContext { const restore = this.appendScript( source, exprRange[0] - exprOffset, + "render", (st, tokens, comments, result) => { const expSt = st as ESTree.ExpressionStatement; const call = expSt.expression as ESTree.CallExpression; @@ -435,6 +535,7 @@ export class ScriptLetContext { const restore = this.appendScript( `function ${part}{`, idRange[0] - 9, + "render", (st, tokens, _comments, result) => { const fnDecl = st as ESTree.FunctionDeclaration; const idNode = fnDecl.id; @@ -483,6 +584,7 @@ export class ScriptLetContext { for (const preparationScript of generatedTypes.preparationScript) { this.appendScriptWithoutOffset( preparationScript, + "render", (node, tokens, comments, result) => { tokens.length = 0; comments.length = 0; @@ -502,6 +604,7 @@ export class ScriptLetContext { const restore = this.appendScript( `{`, block.range[0], + "render", (st, tokens, _comments, result) => { const blockSt = st as ESTree.BlockStatement; @@ -557,6 +660,7 @@ export class ScriptLetContext { const restore = this.appendScript( `(${source})=>{`, maps[0].range[0] - 1, + "render", (st, tokens, comments, result) => { const exprSt = st as ESTree.ExpressionStatement; const fn = exprSt.expression as ESTree.ArrowFunctionExpression; @@ -630,6 +734,7 @@ export class ScriptLetContext { private appendScript( text: string, offset: number, + kind: "generics" | "render", callback: ( node: ESTree.Node, tokens: Token[], @@ -639,13 +744,15 @@ export class ScriptLetContext { ) { const resultCallback = this.appendScriptWithoutOffset( text, + kind, (node, tokens, comments, result) => { - this.fixLocations( + fixLocations( node, tokens, comments, offset - resultCallback.start, result.visitorKeys, + this.ctx, ); callback(node, tokens, comments, result); }, @@ -655,6 +762,7 @@ export class ScriptLetContext { private appendScriptWithoutOffset( text: string, + kind: "generics" | "render", callback: ( node: ESTree.Node, tokens: Token[], @@ -662,7 +770,10 @@ export class ScriptLetContext { options: ScriptLetCallbackOption, ) => void, ) { - const { start: startOffset, end: endOffset } = this.script.addLet(text); + const { start: startOffset, end: endOffset } = this.script.addLet( + text, + kind, + ); const restoreCallback: RestoreCallback = { start: startOffset, @@ -675,7 +786,7 @@ export class ScriptLetContext { private pushScope(restoreCallback: RestoreCallback, closeToken: string) { this.closeScopeCallbacks.push(() => { - this.script.addLet(closeToken); + this.script.addLet(closeToken, "render"); restoreCallback.end = this.script.getCurrentVirtualCodeLength(); }); } @@ -906,7 +1017,7 @@ export class ScriptLetContext { } bufferTokens.push(token); } - this.fixLocations( + fixLocations( map.newNode, bufferTokens, comments.filter( @@ -914,65 +1025,12 @@ export class ScriptLetContext { ), map.range[0] - startOffset, visitorKeys, + this.ctx, ); } tokens.splice(tokenIndex); } - /** Fix locations */ - private fixLocations( - node: ESTree.Node, - tokens: Token[], - comments: Comment[], - offset: number, - visitorKeys?: { [type: string]: string[] }, - ) { - if (offset === 0) { - return; - } - const traversed = new Set(); - traverseNodes(node, { - visitorKeys, - enterNode: (n) => { - if (traversed.has(n)) { - return; - } - traversed.add(n); - if (traversed.has(n.range)) { - if (!traversed.has(n.loc)) { - // However, `Node#loc` may not be shared. - const locs = this.ctx.getConvertLocation({ - start: n.range![0], - end: n.range![1], - }); - applyLocs(n, locs); - traversed.add(n.loc); - } - } else { - const start = n.range![0] + offset; - const end = n.range![1] + offset; - const locs = this.ctx.getConvertLocation({ start, end }); - applyLocs(n, locs); - traversed.add(n.range); - traversed.add(n.loc); - } - }, - leaveNode: Function.prototype as any, - }); - for (const t of tokens) { - const start = t.range[0] + offset; - const end = t.range[1] + offset; - const locs = this.ctx.getConvertLocation({ start, end }); - applyLocs(t, locs); - } - for (const t of comments) { - const start = t.range[0] + offset; - const end = t.range[1] + offset; - const locs = this.ctx.getConvertLocation({ start, end }); - applyLocs(t, locs); - } - } - private generateUniqueId(base: string) { return this.unique.generate( base, @@ -982,18 +1040,75 @@ export class ScriptLetContext { } } -/** - * applyLocs - */ -function applyLocs(target: Locations | ESTree.Node, locs: Locations) { - target.loc = locs.loc; - target.range = locs.range; - if (typeof (target as any).start === "number") { - delete (target as any).start; +function getTypeParameterRanges(code: string, param: TSESTree.TSTypeParameter) { + const idRange: [number, number] = [ + param.range[0], + param.constraint || param.default ? param.name.range[1] : param.range[1], + ]; + let constraintRange: [number, number] | null = null; + let defaultRange: [number, number] | null = null; + if (param.constraint) { + constraintRange = [ + param.constraint.range[0], + param.default ? param.constraint.range[1] : param.range[1], + ]; + const index = getTokenIndex( + code, + (code, index) => code.startsWith("extends", index), + idRange[1], + param.constraint.range[0], + ); + if (index != null) { + idRange[1] = index; + constraintRange[0] = index + 7; + } + } + if (param.default) { + defaultRange = [param.default.range[0], param.range[1]]; + const index = getTokenIndex( + code, + (code, index) => code[index] === "=", + constraintRange?.[1] ?? idRange[1], + param.default.range[0], + ); + if (index != null) { + (constraintRange ?? idRange)[1] = index; + defaultRange[0] = index + 1; + } } - if (typeof (target as any).end === "number") { - delete (target as any).end; + return { idRange, constraintRange, defaultRange }; +} + +function getTokenIndex( + code: string, + targetToken: (code: string, index: number) => boolean, + start: number, + end: number, +) { + let index = start; + while (index < end) { + if (targetToken(code, index)) { + return index; + } + if (code.startsWith("//", index)) { + const lfIndex = code.indexOf("\n", index); + if (lfIndex >= 0) { + index = lfIndex + 1; + continue; + } + return null; + } + if (code.startsWith("/*", index)) { + const endIndex = code.indexOf("*/", index); + if (endIndex >= 0) { + index = endIndex + 2; + continue; + } + return null; + } + index++; } + return null; } /** Get the node to scope map from given scope manager */ diff --git a/src/parser/converts/root.ts b/src/parser/converts/root.ts index 2426cfb4..a0b01cb6 100644 --- a/src/parser/converts/root.ts +++ b/src/parser/converts/root.ts @@ -1,5 +1,8 @@ import type * as SvAST from "../svelte-ast-types"; import type { + SvelteAttribute, + SvelteGenericsDirective, + SvelteLiteral, SvelteName, SvelteProgram, SvelteScriptElement, @@ -10,6 +13,11 @@ import type { Context } from "../../context"; import { convertChildren, extractElementTags } from "./element"; import { convertAttributeTokens } from "./attr"; import type { Scope } from "eslint-scope"; +import { parseScriptWithoutAnalyzeScope } from "../script"; +import type { TSESParseForESLintResult } from "../typescript/types"; +import type * as ESTree from "estree"; +import type { TSESTree } from "@typescript-eslint/types"; +import { fixLocations } from "../../context/fix-locations"; /** * Convert root @@ -44,6 +52,8 @@ export function convertSvelteRoot( ...ctx.getConvertLocation(instance), }; extractAttributes(script, ctx); + if (ctx.parserOptions.svelteFeatures?.experimentalGenerics) + convertGenericsAttribute(script, ctx); extractElementTags(script, ctx, { buildNameNode: (openTokenRange) => { ctx.addToken("HTMLIdentifier", openTokenRange); @@ -181,3 +191,120 @@ function extractAttributes( ); } } + +/** Convert generics attribute */ +function convertGenericsAttribute(script: SvelteScriptElement, ctx: Context) { + const lang = ctx.sourceCode.scripts.attrs.lang; + if (lang !== "ts" && lang !== "typescript") { + return; + } + const genericsAttribute = script.startTag.attributes.find( + (attr): attr is SvelteAttribute & { value: [SvelteLiteral] } => { + return ( + attr.type === "SvelteAttribute" && + attr.key.name === "generics" && + attr.value.length === 1 && + attr.value[0].type === "SvelteLiteral" + ); + }, + ); + if (!genericsAttribute) { + return; + } + const value = genericsAttribute.value[0]; + + const genericValueCode = ctx.code.slice(value.range[0], value.range[1]); + const scriptLet = `void function<${genericValueCode}>(){}`; + let result: TSESParseForESLintResult; + try { + result = parseScriptWithoutAnalyzeScope( + scriptLet, + ctx.sourceCode.scripts.attrs, + { + ...ctx.parserOptions, + // Without typings + project: null, + }, + ) as unknown as TSESParseForESLintResult; + } catch { + // ignore + return; + } + + delete (genericsAttribute as any).boolean; + delete (genericsAttribute as any).value; + + // Remove value token indexes + const firstTokenIndex = ctx.tokens.findIndex( + (token) => + value.range[0] <= token.range[0] && token.range[1] <= value.range[1], + ); + const lastTokenCount = ctx.tokens + .slice(firstTokenIndex) + .findIndex((token) => value.range[1] <= token.range[0]); + ctx.tokens.splice( + firstTokenIndex, + lastTokenCount >= 0 ? lastTokenCount : Infinity, + ); + + const generics = genericsAttribute as any as SvelteGenericsDirective; + generics.type = "SvelteGenericsDirective"; + generics.params = []; + + result.ast.tokens!.shift(); // void + result.ast.tokens!.shift(); // function + result.ast.tokens!.shift(); // < + result.ast.tokens!.pop(); // } + result.ast.tokens!.pop(); // { + result.ast.tokens!.pop(); // ) + result.ast.tokens!.pop(); // ( + result.ast.tokens!.pop(); // > + fixLocations( + result.ast as any, + result.ast.tokens! as any, + result.ast.comments! as any, + value.range[0] - 14, + result.visitorKeys as any, + ctx, + ); + + const { ast } = result; + const statement = ast.body[0] as ESTree.ExpressionStatement; + const rawExpression = statement.expression as ESTree.UnaryExpression; + const fnDecl = rawExpression.argument as ESTree.FunctionExpression; + const typeParameters = (fnDecl as TSESTree.FunctionExpression) + .typeParameters!; + const params = typeParameters.params; + + // Replace tokens + for (const tokensKey of ["tokens", "comments"] as const) { + for (const token of result.ast[tokensKey]!) { + if ( + params.every( + (param) => + token.range[1] <= param.range[0] || + param.range[1] <= token.range[0], + ) + ) { + ctx[tokensKey].push(token as any); + } + } + } + + for (const param of params) { + (param as any).parent = generics; + generics.params.push(param); + ctx.scriptLet.addGenericTypeAliasDeclaration( + param, + (id, typeNode) => { + param.name = id; + if (param.constraint) { + param.constraint = typeNode; + } + }, + (typeNode) => { + param.default = typeNode; + }, + ); + } +} diff --git a/src/parser/parser-options.ts b/src/parser/parser-options.ts index 6f134ced..7b10badd 100644 --- a/src/parser/parser-options.ts +++ b/src/parser/parser-options.ts @@ -19,6 +19,12 @@ export type NormalizedParserOptions = { experimentalObjectRestSpread?: boolean | undefined; [key: string]: any; }; + svelteFeatures?: { + /* -- Experimental Svelte Features -- */ + // Whether to parse the `generics` attribute. + // See https://github.com/sveltejs/rfcs/pull/38 + experimentalGenerics?: boolean; + }; loc: boolean; range: boolean; raw: boolean; diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index 52700c85..8f62923b 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -35,16 +35,18 @@ type TransformInfo = { * See https://github.com/sveltejs/svelte-eslint-parser/blob/main/docs/internal-mechanism.md#scope-types */ export function analyzeTypeScriptInSvelte( - code: { script: string; render: string }, + code: { script: string; generics: string; render: string }, attrs: Record, parserOptions: NormalizedParserOptions, context: AnalyzeTypeScriptContext, ): VirtualTypeScriptContext { - const ctx = new VirtualTypeScriptContext(code.script + code.render); + const ctx = new VirtualTypeScriptContext( + code.script + code.render + code.generics, + ); ctx.appendOriginal(/^\s*/u.exec(code.script)![0].length); const result = parseScriptWithoutAnalyzeScope( - code.script + code.render, + code.script + code.render + code.generics, attrs, { ...parserOptions, @@ -68,6 +70,8 @@ export function analyzeTypeScriptInSvelte( analyzeRenderScopes(code, ctx); + ctx.appendOriginalToEnd(); + return ctx; } /** @@ -512,13 +516,13 @@ function* analyzeDollarDerivedScopes( * Transform source code to provide the correct type information in the HTML templates. */ function analyzeRenderScopes( - code: { script: string; render: string }, + code: { script: string; render: string; generics: string }, ctx: VirtualTypeScriptContext, ) { ctx.appendOriginal(code.script.length); const renderFunctionName = ctx.generateUniqueId("render"); ctx.appendVirtualScript(`function ${renderFunctionName}(){`); - ctx.appendOriginalToEnd(); + ctx.appendOriginal(code.script.length + code.render.length); ctx.appendVirtualScript(`}`); ctx.restoreContext.addRestoreStatementProcess((node, result) => { if ( diff --git a/src/parser/typescript/index.ts b/src/parser/typescript/index.ts index fce42761..b41eb498 100644 --- a/src/parser/typescript/index.ts +++ b/src/parser/typescript/index.ts @@ -10,7 +10,7 @@ import type { TSESParseForESLintResult } from "./types"; * Parse for TypeScript in + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
\ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-output.json new file mode 100644 index 00000000..0249095d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-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": [ + { + "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": "ImportDeclaration", + "importKind": "type", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 49, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 20, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 65, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSAnyKeyword", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 108, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 106, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 102, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 117, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 125, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 117, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSAnyKeyword", + "range": [ + 152, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 19 + } + } + } + ], + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 143, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 141, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 138, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 22 + } + } + } + ], + "range": [ + 98, + 161 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 97, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 91, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 65, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + ], + "range": [ + 61, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 6 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 166, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 175 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 175, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "table", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 184, + 186 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "children", + "range": [ + 191, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "thead", + "range": [ + 204, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 203, + 210 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 210, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 215, + 217 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 214, + 218 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "children", + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "optional": false, + "range": [ + 227, + 237 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + "range": [ + 218, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 238, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + "range": [ + 214, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 243, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 15, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 246, + 254 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "range": [ + 203, + 254 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 15, + "column": 10 + } + } + } + ], + "else": null, + "range": [ + 186, + 261 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 261, + 263 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tbody", + "range": [ + 264, + 269 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 263, + 270 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 270, + 273 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 280, + 284 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 295, + 297 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 294, + 298 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 307, + 313 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + "range": [ + 298, + 314 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 314, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "range": [ + 294, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 273, + 329 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 329, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 21, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 331, + 339 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "range": [ + 263, + 339 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 340, + 348 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + "range": [ + 177, + 348 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 22, + "column": 8 + } + } + } + ], + "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": "import", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 49, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 61, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 4, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "any", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 117, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "any", + "range": [ + 152, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 168, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 175, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 184, + 186 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 187, + 190 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 191, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 204, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t\t", + "range": [ + 210, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 215, + 217 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 219, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 235, + 236 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 240, + 242 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 243, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 257, + 260 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 261, + 263 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 264, + 269 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 270, + 273 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 274, + 279 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 280, + 284 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 285, + 287 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 289, + 290 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 295, + 297 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 298, + 299 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 299, + 306 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 312, + 313 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 313, + 314 + ], + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 315, + 316 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 316, + 318 + ], + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 318, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 323, + 328 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 328, + 329 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 329, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 333, + 338 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 342, + 347 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + } + ], + "range": [ + 0, + 348 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 22, + "column": 8 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-prefer-const-result.json new file mode 100644 index 00000000..653f57f9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-prefer-const-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "prefer-const", + "code": "data", + "line": 4, + "column": 8 + }, + { + "ruleId": "prefer-const", + "code": "children", + "line": 4, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "row", + "line": 4, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json new file mode 100644 index 00000000..35ac168e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json @@ -0,0 +1,3336 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Snippet", + "identifiers": [ + { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "node": { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ] + }, + { + "name": "data", + "identifiers": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 65, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSAnyKeyword", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 108, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 106, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 102, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 117, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 125, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 117, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSAnyKeyword", + "range": [ + 152, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 19 + } + } + } + ], + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 143, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 141, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 138, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 22 + } + } + } + ], + "range": [ + 98, + 161 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 97, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 91, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 65, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 280, + 284 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + }, + { + "name": "children", + "identifiers": [ + { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 65, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSAnyKeyword", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 108, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 106, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 102, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 117, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 125, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 117, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSAnyKeyword", + "range": [ + 152, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 19 + } + } + } + ], + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 143, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 141, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 138, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 22 + } + } + } + ], + "range": [ + 98, + 161 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 97, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 91, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 65, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 191, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 65, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSAnyKeyword", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 108, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 106, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 102, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 117, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 125, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 117, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSAnyKeyword", + "range": [ + 152, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 19 + } + } + } + ], + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 143, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 141, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 138, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 22 + } + } + } + ], + "range": [ + 98, + 161 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 97, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 91, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 65, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 127, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 191, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 280, + 284 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 73, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "d", + "identifiers": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 280, + 284 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 295, + 297 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 294, + 298 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 307, + 313 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + "range": [ + 298, + 314 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 314, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "range": [ + 294, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 273, + 329 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 9 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 307, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-type-output.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-type-output.svelte new file mode 100644 index 00000000..d7a1f1de --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-type-output.svelte @@ -0,0 +1,22 @@ + + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
\ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-input.svelte new file mode 100644 index 00000000..209a7dee --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-input.svelte @@ -0,0 +1,22 @@ + + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-output.json new file mode 100644 index 00000000..275ab745 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-output.json @@ -0,0 +1,4109 @@ +{ + "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 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "body": [ + { + "type": "ImportDeclaration", + "importKind": "type", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 62, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 33, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 78, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 119, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 115, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 128, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 136, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 128, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + } + ], + "range": [ + 162, + 165 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 154, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 152, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 149, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 111, + 170 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 110, + 171 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 104, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 78, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + ], + "range": [ + 74, + 174 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 6 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 175, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 184 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 184, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "table", + "range": [ + 187, + 192 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 186, + 193 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 193, + 195 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "children", + "range": [ + 200, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "thead", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 212, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 219, + 223 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 224, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 223, + 227 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "children", + "range": [ + 236, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "optional": false, + "range": [ + 236, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + "range": [ + 227, + 247 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 247, + 252 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + "range": [ + 223, + 252 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 15, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 255, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "range": [ + 212, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 15, + "column": 10 + } + } + } + ], + "else": null, + "range": [ + 195, + 270 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 270, + 272 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tbody", + "range": [ + 273, + 278 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 272, + 279 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 279, + 282 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 289, + 293 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 304, + 306 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 303, + 307 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 316, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + "range": [ + 307, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 323, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "range": [ + 303, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 282, + 338 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 338, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 21, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 340, + 348 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "range": [ + 272, + 348 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 348, + 349 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + "range": [ + 186, + 357 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 22, + "column": 8 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 57, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 62, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 4, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 128, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 177, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 184, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 187, + 192 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 193, + 195 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 196, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 200, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t\t", + "range": [ + 219, + 223 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 224, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 228, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 236, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 249, + 251 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 257, + 262 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 266, + 269 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 270, + 272 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 273, + 278 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 279, + 282 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 283, + 288 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 289, + 293 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 294, + 296 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 298, + 299 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 303, + 304 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 304, + 306 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 307, + 308 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 308, + 315 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 319, + 320 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 321, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 323, + 324 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 325, + 327 + ], + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 327, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 332, + 337 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 337, + 338 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 338, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 342, + 347 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 348, + 349 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + } + ], + "range": [ + 0, + 358 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-prefer-const-result.json new file mode 100644 index 00000000..653f57f9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-prefer-const-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "prefer-const", + "code": "data", + "line": 4, + "column": 8 + }, + { + "ruleId": "prefer-const", + "code": "children", + "line": 4, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "row", + "line": 4, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json new file mode 100644 index 00000000..ad3c4a3d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json @@ -0,0 +1,3690 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Snippet", + "identifiers": [ + { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "node": { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ] + }, + { + "name": "data", + "identifiers": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 78, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 119, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 115, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 128, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 136, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 128, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + } + ], + "range": [ + 162, + 165 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 154, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 152, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 149, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 111, + 170 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 110, + 171 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 104, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 78, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 289, + 293 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + }, + { + "name": "children", + "identifiers": [ + { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 78, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 119, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 115, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 128, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 136, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 128, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + } + ], + "range": [ + 162, + 165 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 154, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 152, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 149, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 111, + 170 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 110, + 171 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 104, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 78, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 200, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 236, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 78, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 121, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 119, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 115, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 128, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 136, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 128, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + } + ], + "range": [ + 162, + 165 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 154, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 152, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 149, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 111, + 170 + ], + "loc": { + "start": { + "line": 4, + "column": 38 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 110, + 171 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 104, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "range": [ + 78, + 173 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 154, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 200, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 289, + 293 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 236, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 236, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "d", + "identifiers": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 289, + 293 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 304, + 306 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 303, + 307 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 316, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + "range": [ + 307, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 323, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + "range": [ + 303, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 282, + 338 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 9 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 316, + 319 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 104, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-type-output.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-type-output.svelte new file mode 100644 index 00000000..9eda792c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-type-output.svelte @@ -0,0 +1,22 @@ + + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-input.svelte b/tests/fixtures/parser/ast/svelte5/generics01-snippets-input.svelte new file mode 100644 index 00000000..a9600a08 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-input.svelte @@ -0,0 +1,23 @@ + + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-output.json b/tests/fixtures/parser/ast/svelte5/generics01-snippets-output.json new file mode 100644 index 00000000..097a30d3 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-output.json @@ -0,0 +1,4251 @@ +{ + "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 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "body": [ + { + "type": "ImportDeclaration", + "importKind": "type", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 62, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 33, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 74, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 90, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 131, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 140, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 148, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 140, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 161, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + } + ], + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + ], + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "range": [ + 166, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 161, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 20 + } + } + } + ], + "range": [ + 123, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "range": [ + 122, + 183 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "range": [ + 116, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "range": [ + 90, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 9, + "column": 5 + } + } + } + ], + "range": [ + 86, + 186 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 187, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "range": [ + 0, + 196 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 196, + 198 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "table", + "range": [ + 199, + 204 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 198, + 205 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 205, + 207 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "children", + "range": [ + 212, + 220 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "thead", + "range": [ + 225, + 230 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 224, + 231 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 231, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 236, + 238 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 235, + 239 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "children", + "range": [ + 248, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "optional": false, + "range": [ + 248, + 258 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + "range": [ + 239, + 259 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 259, + 264 + ], + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + "range": [ + 235, + 264 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 264, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 16, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 267, + 275 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + "range": [ + 224, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 16, + "column": 10 + } + } + } + ], + "else": null, + "range": [ + 207, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tbody", + "range": [ + 285, + 290 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 284, + 291 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 291, + 294 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 301, + 305 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 316, + 318 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 328, + 334 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "range": [ + 319, + 335 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 335, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 28 + } + } + }, + "range": [ + 315, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 294, + 350 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 350, + 352 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 352, + 360 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + "range": [ + 284, + 360 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 23, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 361, + 369 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + "range": [ + 198, + 369 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 23, + "column": 8 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 57, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 62, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 140, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 161, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 189, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 196, + 198 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 199, + 204 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 205, + 207 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 212, + 220 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 225, + 230 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t\t", + "range": [ + 231, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 235, + 236 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 236, + 238 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 240, + 247 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 248, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 15, + "column": 24 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 261, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 29 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 15, + "column": 31 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 264, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 269, + 274 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 282, + 284 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 285, + 290 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 291, + 294 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 295, + 300 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 301, + 305 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 306, + 308 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 315, + 316 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 316, + 318 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 318, + 319 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 319, + 320 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 320, + 327 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 333, + 334 + ], + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 334, + 335 + ], + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 335, + 336 + ], + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 337, + 339 + ], + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 27 + }, + "end": { + "line": 20, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 344, + 349 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 350, + 352 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 352, + 353 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tbody", + "range": [ + 354, + 359 + ], + "loc": { + "start": { + "line": 22, + "column": 3 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 23, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 362, + 363 + ], + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 363, + 368 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 368, + 369 + ], + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + } + ], + "range": [ + 0, + 370 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 24, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/generics01-snippets-prefer-const-result.json new file mode 100644 index 00000000..98c34fa8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-prefer-const-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "prefer-const", + "code": "data", + "line": 5, + "column": 8 + }, + { + "ruleId": "prefer-const", + "code": "children", + "line": 5, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "row", + "line": 5, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json new file mode 100644 index 00000000..f77765a0 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json @@ -0,0 +1,3888 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Snippet", + "identifiers": [ + { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "node": { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ] + }, + { + "name": "A", + "identifiers": [ + { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 74, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + } + } + ] + }, + { + "name": "data", + "identifiers": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 90, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 131, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 140, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 148, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 140, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 161, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + } + ], + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + ], + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "range": [ + 166, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 161, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 20 + } + } + } + ], + "range": [ + 123, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "range": [ + 122, + 183 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "range": [ + 116, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "range": [ + 90, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 9, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 301, + 305 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + } + ] + }, + { + "name": "children", + "identifiers": [ + { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 90, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 131, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 140, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 148, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 140, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 161, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + } + ], + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + ], + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "range": [ + 166, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 161, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 20 + } + } + } + ], + "range": [ + 123, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "range": [ + 122, + 183 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "range": [ + 116, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "range": [ + 90, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 9, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 212, + 220 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 248, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 90, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 131, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 140, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 148, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 140, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 161, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + } + ], + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + ], + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "range": [ + 166, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 161, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 20 + } + } + } + ], + "range": [ + 123, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "range": [ + 122, + 183 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "range": [ + 116, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "range": [ + 90, + 185 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 9, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "A", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 150, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 166, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Snippet", + "range": [ + 47, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "A", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "A", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 212, + 220 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 301, + 305 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 248, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 248, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "d", + "identifiers": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "data", + "range": [ + 301, + 305 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 316, + 318 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 328, + 334 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "range": [ + 319, + 335 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 335, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 28 + } + } + }, + "range": [ + 315, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 28 + } + } + } + ], + "else": null, + "range": [ + 294, + 350 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 9 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 328, + 331 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 108, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-type-output.svelte b/tests/fixtures/parser/ast/svelte5/generics01-snippets-type-output.svelte new file mode 100644 index 00000000..c88981da --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-type-output.svelte @@ -0,0 +1,23 @@ + + + + {#if children} + + {@render children()} + + {/if} + + {#each data as d} + {@render row(d)} + {/each} + +
diff --git a/tests/fixtures/parser/ast/ts-generics01-input.svelte b/tests/fixtures/parser/ast/ts-generics01-input.svelte new file mode 100644 index 00000000..31a82af3 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics01-input.svelte @@ -0,0 +1,9 @@ + diff --git a/tests/fixtures/parser/ast/ts-generics01-no-unused-vars-result.json b/tests/fixtures/parser/ast/ts-generics01-no-unused-vars-result.json new file mode 100644 index 00000000..17bb9458 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics01-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "dispatch", + "line": 8, + "column": 11 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics01-output.json b/tests/fixtures/parser/ast/ts-generics01-output.json new file mode 100644 index 00000000..a747f502 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics01-output.json @@ -0,0 +1,2164 @@ +{ + "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 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSBooleanKeyword", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "in": false, + "out": false, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "range": [ + 18, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "body": [ + { + "type": "ImportDeclaration", + "importKind": "value", + "source": { + "type": "Literal", + "raw": "\"svelte\"", + "value": "svelte", + "range": [ + 91, + 99 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "local": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + ], + "range": [ + 55, + 100 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "init": null, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 113, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 106, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "init": null, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + ], + "range": [ + 141, + 154 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 134, + 154 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 166, + 182 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 159, + 182 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 205, + 226 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "arrayItemClick", + "range": [ + 228, + 242 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 58 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 242, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 58 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 228, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 61 + } + } + } + ], + "range": [ + 227, + 246 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 62 + } + } + } + ], + "range": [ + 226, + 247 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 63 + } + } + }, + "range": [ + 205, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 65 + } + } + }, + "range": [ + 194, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 65 + } + } + } + ], + "range": [ + 188, + 250 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 66 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 251, + 260 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 260 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "boolean", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 86, + 90 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "String", + "value": "\"svelte\"", + "range": [ + 91, + 99 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 106, + 112 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 117, + 123 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 134, + 140 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 141, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "item1", + "range": [ + 145, + 150 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 159, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 166, + 169 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 170, + 176 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 188, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "createEventDispatcher", + "range": [ + 205, + 226 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": "Identifier", + "value": "arrayItemClick", + "range": [ + 228, + 242 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 8, + "column": 58 + }, + "end": { + "line": 8, + "column": 59 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 8, + "column": 61 + }, + "end": { + "line": 8, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 8, + "column": 62 + }, + "end": { + "line": 8, + "column": 63 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 8, + "column": 63 + }, + "end": { + "line": 8, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 64 + }, + "end": { + "line": 8, + "column": 65 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 249, + 250 + ], + "loc": { + "start": { + "line": 8, + "column": 65 + }, + "end": { + "line": 8, + "column": 66 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 253, + 259 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + } + ], + "range": [ + 0, + 261 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics01-scope-output.json b/tests/fixtures/parser/ast/ts-generics01-scope-output.json new file mode 100644 index 00000000..86bd8ab1 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics01-scope-output.json @@ -0,0 +1,2375 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "createEventDispatcher", + "identifiers": [ + { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "node": { + "type": "ImportSpecifier", + "importKind": "value", + "imported": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "local": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 205, + 226 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + } + ] + }, + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "init": null, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 117, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ] + }, + { + "name": "item1", + "identifiers": [ + { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "init": null, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "item1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 176, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 170, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ] + }, + { + "name": "dispatch", + "identifiers": [ + { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 205, + 226 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "arrayItemClick", + "range": [ + 228, + 242 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 58 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "X", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 242, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 58 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "range": [ + 228, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 61 + } + } + } + ], + "range": [ + 227, + 246 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 62 + } + } + } + ], + "range": [ + 226, + 247 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 63 + } + } + }, + "range": [ + 205, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 65 + } + } + }, + "range": [ + 194, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 65 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSBooleanKeyword", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "in": false, + "out": false, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ] + }, + { + "name": "X", + "identifiers": [ + { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "const": false, + "in": false, + "out": false, + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "X", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "X", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "dispatch", + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 205, + 226 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "createEventDispatcher", + "range": [ + 63, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "X", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 8, + "column": 60 + }, + "end": { + "line": 8, + "column": 61 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "X", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics01-type-output.svelte b/tests/fixtures/parser/ast/ts-generics01-type-output.svelte new file mode 100644 index 00000000..43d89c6c --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics01-type-output.svelte @@ -0,0 +1,9 @@ + diff --git a/tests/fixtures/parser/ast/ts-generics02-input.svelte b/tests/fixtures/parser/ast/ts-generics02-input.svelte new file mode 100644 index 00000000..fb71927e --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics02-input.svelte @@ -0,0 +1,11 @@ + + + + +{#each array as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics02-output.json b/tests/fixtures/parser/ast/ts-generics02-output.json new file mode 100644 index 00000000..3f29b63c --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics02-output.json @@ -0,0 +1,1818 @@ +{ + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + } + ], + "range": [ + 76, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "in": false, + "out": false, + "range": [ + 96, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + ], + "range": [ + 86, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 42 + } + } + } + ], + "selfClosing": false, + "range": [ + 68, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 43 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "init": null, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "range": [ + 123, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 116, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 139, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 68, + 148 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 148, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "range": [ + 173, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 150, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 59, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 98, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 42 + }, + "end": { + "line": 5, + "column": 43 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 116, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 123, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array", + "range": [ + 127, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 141, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 148, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 163, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "range": [ + 0, + 185 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics02-scope-output.json b/tests/fixtures/parser/ast/ts-generics02-scope-output.json new file mode 100644 index 00000000..46c7e223 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics02-scope-output.json @@ -0,0 +1,1372 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Foo", + "identifiers": [ + { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ] + }, + { + "name": "array", + "identifiers": [ + { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "init": null, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "in": false, + "out": false, + "range": [ + 96, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 127, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "range": [ + 173, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 150, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics02-type-output.svelte b/tests/fixtures/parser/ast/ts-generics02-type-output.svelte new file mode 100644 index 00000000..b18d8821 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics02-type-output.svelte @@ -0,0 +1,11 @@ + + + + +{#each array as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics03-input.svelte b/tests/fixtures/parser/ast/ts-generics03-input.svelte new file mode 100644 index 00000000..5b8acf40 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics03-input.svelte @@ -0,0 +1,15 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics03-output.json b/tests/fixtures/parser/ast/ts-generics03-output.json new file mode 100644 index 00000000..a1f76f56 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics03-output.json @@ -0,0 +1,2598 @@ +{ + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + } + ], + "range": [ + 76, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "in": false, + "out": false, + "range": [ + 96, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "in": false, + "out": false, + "range": [ + 111, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 54 + } + } + } + ], + "range": [ + 86, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 55 + } + } + } + ], + "selfClosing": false, + "range": [ + 68, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 56 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 136, + 152 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 129, + 152 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "init": null, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + ], + "range": [ + 164, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 157, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 181, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "range": [ + 68, + 190 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 190, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 199, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "range": [ + 216, + 219 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 192, + 227 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 235, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 228, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + ], + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 59, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 98, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 113, + 120 + ], + "loc": { + "start": { + "line": 5, + "column": 46 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 54 + }, + "end": { + "line": 5, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 55 + }, + "end": { + "line": 5, + "column": 56 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 136, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 140, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 164, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 168, + 174 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 183, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 190, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 193, + 198 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 199, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 206, + 208 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 221, + 226 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 229, + 234 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 235, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 242, + 244 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 257, + 262 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + ], + "range": [ + 0, + 264 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 16, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics03-scope-output.json b/tests/fixtures/parser/ast/ts-generics03-scope-output.json new file mode 100644 index 00000000..5447617d --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics03-scope-output.json @@ -0,0 +1,2571 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Foo", + "identifiers": [ + { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ] + }, + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 199, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "init": null, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 235, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "in": false, + "out": false, + "range": [ + 96, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + } + ] + }, + { + "name": "U", + "identifiers": [ + { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "in": false, + "out": false, + "range": [ + 111, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 54 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 199, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 235, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 176, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 174, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 168, + 179 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 53 + }, + "end": { + "line": 5, + "column": 54 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 199, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "range": [ + 216, + 219 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 192, + 227 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 12, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 235, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 228, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics03-type-output.svelte b/tests/fixtures/parser/ast/ts-generics03-type-output.svelte new file mode 100644 index 00000000..286bc071 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics03-type-output.svelte @@ -0,0 +1,15 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics04-with-spaces-input.svelte b/tests/fixtures/parser/ast/ts-generics04-with-spaces-input.svelte new file mode 100644 index 00000000..dd26d48d --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics04-with-spaces-input.svelte @@ -0,0 +1,21 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics04-with-spaces-output.json b/tests/fixtures/parser/ast/ts-generics04-with-spaces-output.json new file mode 100644 index 00000000..147ea12c --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics04-with-spaces-output.json @@ -0,0 +1,2617 @@ +{ + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + } + ], + "range": [ + 76, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "in": false, + "out": false, + "range": [ + 99, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "in": false, + "out": false, + "range": [ + 136, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 10, + "column": 5 + } + } + } + ], + "range": [ + 86, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 11, + "column": 5 + } + } + } + ], + "selfClosing": false, + "range": [ + 68, + 158 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "init": null, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "range": [ + 170, + 186 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 163, + 186 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "init": null, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + ], + "range": [ + 198, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 191, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 215, + 224 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + "range": [ + 68, + 224 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 224, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 233, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 226, + 261 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 19, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 262, + 297 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " Comments", + "range": [ + 122, + 133 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 15 + } + } + } + ], + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 59, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 105, + 112 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 138, + 145 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 163, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 170, + 173 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 174, + 180 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 191, + 197 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 198, + 201 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 202, + 208 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 217, + 223 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 224, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 227, + 232 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 233, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 240, + 242 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 255, + 260 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 19, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 276, + 278 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 291, + 296 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + ], + "range": [ + 0, + 298 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 22, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics04-with-spaces-scope-output.json b/tests/fixtures/parser/ast/ts-generics04-with-spaces-scope-output.json new file mode 100644 index 00000000..01355c15 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics04-with-spaces-scope-output.json @@ -0,0 +1,2571 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Foo", + "identifiers": [ + { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ] + }, + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "init": null, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 233, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "init": null, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "in": false, + "out": false, + "range": [ + 99, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + } + ] + }, + { + "name": "U", + "identifiers": [ + { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "in": false, + "out": false, + "range": [ + 136, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 10, + "column": 5 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 233, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 174, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + "range": [ + 202, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 233, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 226, + 261 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 18, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 262, + 297 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics04-with-spaces-type-output.svelte b/tests/fixtures/parser/ast/ts-generics04-with-spaces-type-output.svelte new file mode 100644 index 00000000..642b19e6 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics04-with-spaces-type-output.svelte @@ -0,0 +1,21 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics05-with-spaces-input.svelte b/tests/fixtures/parser/ast/ts-generics05-with-spaces-input.svelte new file mode 100644 index 00000000..737af600 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics05-with-spaces-input.svelte @@ -0,0 +1,27 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics05-with-spaces-output.json b/tests/fixtures/parser/ast/ts-generics05-with-spaces-output.json new file mode 100644 index 00000000..d08e84a6 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics05-with-spaces-output.json @@ -0,0 +1,3135 @@ +{ + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + } + ], + "range": [ + 76, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "default": { + "type": "TSNumberKeyword", + "range": [ + 139, + 145 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + "in": false, + "out": false, + "range": [ + 99, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 225, + 231 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + ], + "range": [ + 203, + 251 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "range": [ + 197, + 251 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "default": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 266, + 272 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "TSNumberKeyword", + "range": [ + 274, + 280 + ], + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 28 + } + } + } + ], + "range": [ + 265, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 259, + 265 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "range": [ + 259, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "in": false, + "out": false, + "range": [ + 165, + 281 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 16, + "column": 29 + } + } + } + ], + "range": [ + 86, + 283 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 17, + "column": 1 + } + } + } + ], + "selfClosing": false, + "range": [ + 68, + 284 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "init": null, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + ], + "range": [ + 296, + 312 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 289, + 312 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "init": null, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + ], + "range": [ + 324, + 340 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 317, + 340 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 341, + 350 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + "range": [ + 68, + 350 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 350, + 352 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 359, + 365 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 352, + 387 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 387, + 388 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 25, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 395, + 401 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + "range": [ + 412, + 415 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 388, + 423 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 27, + "column": 7 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " Comments", + "range": [ + 101, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Block", + "value": " = ", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Line", + "value": " Comments", + "range": [ + 151, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Block", + "value": " extends ", + "range": [ + 167, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Block", + "value": " = ", + "range": [ + 211, + 218 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "Line", + "value": " =", + "range": [ + 233, + 237 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 18 + } + } + } + ], + "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": "context", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "module", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 59, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 69, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "lang", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 82, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "generics", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 117, + 124 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 139, + 145 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 32 + }, + "end": { + "line": 7, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 185, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Record", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 225, + 231 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Record", + "range": [ + 259, + 265 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 266, + 272 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 274, + 280 + ], + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 289, + 295 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 296, + 299 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 300, + 306 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 309, + 310 + ], + "loc": { + "start": { + "line": 18, + "column": 24 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 317, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 324, + 327 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 328, + 334 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 334, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 337, + 338 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 19, + "column": 26 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 342, + 343 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 343, + 349 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 350, + 352 + ], + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 352, + 353 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 353, + 358 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 359, + 365 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 366, + 368 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 22, + "column": 18 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 376, + 377 + ], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 380, + 381 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 381, + 386 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 386, + 387 + ], + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 387, + 388 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 25, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 388, + 389 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 389, + 394 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 395, + 401 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 402, + 404 + ], + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 412, + 413 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 414, + 415 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 416, + 417 + ], + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 417, + 422 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 422, + 423 + ], + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + } + } + ], + "range": [ + 0, + 424 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 28, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics05-with-spaces-scope-output.json b/tests/fixtures/parser/ast/ts-generics05-with-spaces-scope-output.json new file mode 100644 index 00000000..ab3ee943 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics05-with-spaces-scope-output.json @@ -0,0 +1,2840 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Foo", + "identifiers": [ + { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "typeAnnotation": { + "type": "TSUnionType", + "types": [ + { + "type": "TSNumberKeyword", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "TSStringKeyword", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "range": [ + 41, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ] + }, + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "init": null, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 359, + 365 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "init": null, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 395, + 401 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "Foo", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "default": { + "type": "TSNumberKeyword", + "range": [ + 139, + 145 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + "in": false, + "out": false, + "range": [ + 99, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 7, + "column": 32 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + } + ] + }, + { + "name": "U", + "identifiers": [ + { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 225, + 231 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + ], + "range": [ + 203, + 251 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "range": [ + 197, + 251 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "default": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 266, + 272 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "TSNumberKeyword", + "range": [ + 274, + 280 + ], + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 28 + } + } + } + ], + "range": [ + 265, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 259, + 265 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "range": [ + 259, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "in": false, + "out": false, + "range": [ + 165, + 281 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 16, + "column": 29 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 359, + 365 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "range": [ + 308, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 300, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 395, + 401 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + "range": [ + 336, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + "range": [ + 328, + 339 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Foo", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Foo", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 259, + 265 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 359, + 365 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 352, + 387 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 24, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 395, + 401 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + "range": [ + 412, + 415 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 388, + 423 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 27, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 259, + 265 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics05-with-spaces-type-output.svelte b/tests/fixtures/parser/ast/ts-generics05-with-spaces-type-output.svelte new file mode 100644 index 00000000..b7ee284d --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics05-with-spaces-type-output.svelte @@ -0,0 +1,27 @@ + + + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics06-complex-input.svelte b/tests/fixtures/parser/ast/ts-generics06-complex-input.svelte new file mode 100644 index 00000000..6c0f7384 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics06-complex-input.svelte @@ -0,0 +1,19 @@ + + +{#each array1 as a} + {a.foo} {a.bar} +{/each} +{#each array2 as a} + {a.b.foo} {a.c.bar} +{/each} +{#each array3 as a} + {a[0].b.foo} {a[1].bar} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics06-complex-output.json b/tests/fixtures/parser/ast/ts-generics06-complex-output.json new file mode 100644 index 00000000..8698998c --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics06-complex-output.json @@ -0,0 +1,5398 @@ +{ + "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 + } + } + }, + { + "type": "SvelteGenericsDirective", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "params": [ + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 45, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 42, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "range": [ + 58, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "range": [ + 55, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 37 + } + } + } + ], + "range": [ + 41, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "default": { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 71, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSLiteralType", + "literal": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 71, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 79, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSLiteralType", + "literal": { + "type": "Literal", + "raw": "'2'", + "value": "2", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 79, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + ], + "range": [ + 70, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "in": false, + "out": false, + "range": [ + 31, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + } + ], + "range": [ + 108, + 119 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 102, + 119 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "default": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + } + ], + "range": [ + 128, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "range": [ + 122, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + "in": false, + "out": false, + "range": [ + 92, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "default": { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "in": false, + "out": false, + "range": [ + 143, + 166 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "range": [ + 18, + 169 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 170 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 182, + 198 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 175, + 198 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "init": null, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + ], + "range": [ + 210, + 226 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 203, + 226 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "init": null, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + ], + "range": [ + 238, + 254 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 231, + 254 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 255, + 264 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 264 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 264, + 266 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 273, + 279 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 293, + 296 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "range": [ + 291, + 296 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "range": [ + 290, + 297 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 301, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 298, + 305 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 19 + } + } + } + ], + "else": null, + "range": [ + 266, + 313 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 313, + 314 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 321, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "range": [ + 339, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 343, + 346 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + "range": [ + 339, + 346 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + "range": [ + 338, + 347 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "range": [ + 349, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 353, + 356 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 349, + 356 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 348, + 357 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "else": null, + "range": [ + 314, + 365 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 365, + 366 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array3", + "range": [ + 373, + 379 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 393, + 394 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "range": [ + 391, + 395 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 396, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "range": [ + 391, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 398, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "range": [ + 391, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "range": [ + 390, + 402 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 402, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "optional": false, + "property": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 409, + 412 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 404, + 412 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 403, + 413 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 27 + } + } + } + ], + "else": null, + "range": [ + 366, + 421 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 19, + "column": 7 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 33, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 71, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 79, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "String", + "value": "'2'", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 2, + "column": 59 + }, + "end": { + "line": 2, + "column": 60 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 94, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "Record", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "Record", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 3, + "column": 45 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 138, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 48 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 3, + "column": 49 + }, + "end": { + "line": 3, + "column": 50 + } + } + }, + { + "type": "Identifier", + "value": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 175, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 186, + 192 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 203, + 209 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 214, + 220 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 231, + 237 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 238, + 241 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array3", + "range": [ + 242, + 248 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 257, + 263 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 264, + 266 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 267, + 272 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 273, + 279 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 280, + 282 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 293, + 296 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 296, + 297 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 298, + 299 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 301, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 307, + 312 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 312, + 313 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 313, + 314 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 315, + 320 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 321, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 328, + 330 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 340, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 342, + 343 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 343, + 346 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 346, + 347 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 348, + 349 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 352, + 353 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 353, + 356 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 358, + 359 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 359, + 364 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 364, + 365 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 365, + 366 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 17, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 366, + 367 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array3", + "range": [ + 373, + 379 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 380, + 382 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 384, + 385 + ], + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 390, + 391 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 392, + 393 + ], + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 393, + 394 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 394, + 395 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 395, + 396 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 396, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 397, + 398 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 398, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 401, + 402 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 402, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 403, + 404 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 407, + 408 + ], + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 408, + 409 + ], + "loc": { + "start": { + "line": 18, + "column": 22 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 409, + 412 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 412, + 413 + ], + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 414, + 415 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 415, + 420 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + } + ], + "range": [ + 0, + 422 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 20, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics06-complex-requirements.json b/tests/fixtures/parser/ast/ts-generics06-complex-requirements.json new file mode 100644 index 00000000..5ace0ee2 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics06-complex-requirements.json @@ -0,0 +1,5 @@ +{ + "parse": { + "svelte": ">=4" + } +} diff --git a/tests/fixtures/parser/ast/ts-generics06-complex-scope-output.json b/tests/fixtures/parser/ast/ts-generics06-complex-scope-output.json new file mode 100644 index 00000000..030e1f38 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics06-complex-scope-output.json @@ -0,0 +1,5419 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "init": null, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 273, + 279 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "init": null, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 321, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array3", + "identifiers": [ + { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "init": null, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array3", + "range": [ + 373, + 379 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + } + ] + }, + { + "name": "T", + "identifiers": [ + { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 45, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 42, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "range": [ + 58, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "range": [ + 55, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 37 + } + } + } + ], + "range": [ + 41, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "default": { + "type": "TSTypeLiteral", + "members": [ + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 71, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSLiteralType", + "literal": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + "range": [ + 71, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "TSPropertySignature", + "computed": false, + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 79, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSLiteralType", + "literal": { + "type": "Literal", + "raw": "'2'", + "value": "2", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 79, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + ], + "range": [ + 70, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "in": false, + "out": false, + "range": [ + 31, + 88 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 59 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + } + ] + }, + { + "name": "U", + "identifiers": [ + { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + } + ], + "range": [ + 108, + 119 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 102, + 119 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "default": { + "type": "TSTypeReference", + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSStringKeyword", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + } + ], + "range": [ + 128, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + "typeName": { + "type": "Identifier", + "name": "Record", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "range": [ + 122, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + "in": false, + "out": false, + "range": [ + 92, + 139 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 49 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + } + ] + }, + { + "name": "V", + "identifiers": [ + { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + "node": { + "type": "TSTypeParameter", + "name": { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + "const": false, + "constraint": { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "default": { + "type": "TSTupleType", + "elementTypes": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ], + "range": [ + 161, + 166 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "in": false, + "out": false, + "range": [ + 143, + 166 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "V", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 273, + 279 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 192, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 186, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 321, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "range": [ + 214, + 225 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array3", + "range": [ + 373, + 379 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array3", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "V", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 250, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 248, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "U", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "T", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 273, + 279 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 293, + 296 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "range": [ + 291, + 296 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "range": [ + 290, + 297 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 301, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 298, + 305 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 19 + } + } + } + ], + "else": null, + "range": [ + 266, + 313 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 13, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 321, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "range": [ + 339, + 342 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 343, + 346 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + "range": [ + 339, + 346 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + "range": [ + 338, + 347 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "range": [ + 349, + 352 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 353, + 356 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 349, + 356 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 348, + 357 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 23 + } + } + } + ], + "else": null, + "range": [ + 314, + 365 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 16, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array3", + "range": [ + 373, + 379 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 393, + 394 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "range": [ + 391, + 395 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 396, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "range": [ + 391, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "foo", + "range": [ + 398, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "range": [ + 391, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "range": [ + 390, + 402 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": " ", + "range": [ + 402, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "optional": false, + "property": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 409, + 412 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 404, + 412 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 403, + 413 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 27 + } + } + } + ], + "else": null, + "range": [ + 366, + 421 + ], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 19, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 383, + 384 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Record", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics06-complex-type-output.svelte b/tests/fixtures/parser/ast/ts-generics06-complex-type-output.svelte new file mode 100644 index 00000000..dd2aa0c5 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics06-complex-type-output.svelte @@ -0,0 +1,19 @@ + + +{#each array1 as a} + {a.foo} {a.bar} +{/each} +{#each array2 as a} + {a.b.foo} {a.c.bar} +{/each} +{#each array3 as a} + {a[0].b.foo} {a[1].bar} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics07-syntax-error-input.svelte b/tests/fixtures/parser/ast/ts-generics07-syntax-error-input.svelte new file mode 100644 index 00000000..a56829b1 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics07-syntax-error-input.svelte @@ -0,0 +1,11 @@ + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/fixtures/parser/ast/ts-generics07-syntax-error-no-undef-result.json b/tests/fixtures/parser/ast/ts-generics07-syntax-error-no-undef-result.json new file mode 100644 index 00000000..d46d93bf --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics07-syntax-error-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "T", + "line": 2, + "column": 24 + }, + { + "ruleId": "no-undef", + "code": "U", + "line": 3, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics07-syntax-error-output.json b/tests/fixtures/parser/ast/ts-generics07-syntax-error-output.json new file mode 100644 index 00000000..9f39eb65 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics07-syntax-error-output.json @@ -0,0 +1,1965 @@ +{ + "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 + } + } + }, + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "T extends number, U ex T", + "range": [ + 28, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 52 + } + } + } + ], + "range": [ + 18, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "init": null, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "range": [ + 66, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 59, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "init": null, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + ], + "range": [ + 94, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 87, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 111, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "range": [ + 0, + 120 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 120, + 122 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "range": [ + 146, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 122, + 157 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 158, + 193 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "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": "HTMLIdentifier", + "value": "generics", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "HTMLText", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "HTMLText", + "value": "extends", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "HTMLText", + "value": "number,", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "HTMLText", + "value": "U", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "HTMLText", + "value": "ex", + "range": [ + 48, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "HTMLText", + "value": "T", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 59, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 70, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 94, + 97 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 98, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 113, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 120, + 122 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array1", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 136, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 159, + 164 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "array2", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 172, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 187, + 192 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + ], + "range": [ + 0, + 194 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics07-syntax-error-scope-output.json b/tests/fixtures/parser/ast/ts-generics07-syntax-error-scope-output.json new file mode 100644 index 00000000..327bb8cd --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics07-syntax-error-scope-output.json @@ -0,0 +1,2013 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "array1", + "identifiers": [ + { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "init": null, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + } + ] + }, + { + "name": "array2", + "identifiers": [ + { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "init": null, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "array1", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array1", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "array2", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "array2", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "typeAnnotation": { + "type": "TSArrayType", + "elementType": { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 106, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 104, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "range": [ + 98, + 109 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 26 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array1", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "range": [ + 146, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 122, + 157 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "array2", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "range": [ + 182, + 185 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 7 + } + } + } + ], + "else": null, + "range": [ + 158, + 193 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 11, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "T", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "U", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-generics07-syntax-error-type-output.svelte b/tests/fixtures/parser/ast/ts-generics07-syntax-error-type-output.svelte new file mode 100644 index 00000000..69e81e81 --- /dev/null +++ b/tests/fixtures/parser/ast/ts-generics07-syntax-error-type-output.svelte @@ -0,0 +1,11 @@ + + +{#each array1 as a} + {a} +{/each} +{#each array2 as a} + {a} +{/each} diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index aabd3713..1b94d3a7 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -21,6 +21,9 @@ const BASIC_PARSER_OPTIONS: Linter.ParserOptions = { }, project: require.resolve("../../fixtures/tsconfig.test.json"), extraFileExtensions: [".svelte"], + svelteFeatures: { + experimentalGenerics: true, + }, }; const SVELTE5_SCOPE_VARIABLES_BASE = [ diff --git a/tests/src/parser/typescript/index.ts b/tests/src/parser/typescript/index.ts index 31079c9d..ddaaef64 100644 --- a/tests/src/parser/typescript/index.ts +++ b/tests/src/parser/typescript/index.ts @@ -13,6 +13,9 @@ describe("Check for typescript analyze result.", () => { config, meetRequirements, } of listupFixtures()) { + if (!meetRequirements("parse")) { + return; + } if (!input.includes('lang="ts"')) { continue; } @@ -49,12 +52,12 @@ describe("Check for typescript analyze result.", () => { }, ); const result = parseScriptInSvelte( - code.script + code.render, + code.script + code.render + code.generics, attrs, parserOptions, ); const info = { - code: code.script + code.render, + code: code.script + code.render + code.generics, virtualScriptCode: analyzedResult._virtualScriptCode, }; diff --git a/tools/update-fixtures.ts b/tools/update-fixtures.ts index 40994a7d..2099969a 100644 --- a/tools/update-fixtures.ts +++ b/tools/update-fixtures.ts @@ -201,7 +201,7 @@ function buildTypes( enterNode(node) { if (node.type === "SvelteScriptElement" && node.body.length) { scriptLineRange.push([ - node.body[0].loc!.start.line - 1, + node.startTag.loc.end.line - 1, node.body[node.body.length - 1].loc!.end.line - 1, ]); } @@ -212,6 +212,17 @@ function buildTypes( node.expression.loc!.end.line - 2, ]); } + if (node.type === "SvelteGenericsDirective") { + const endLine = Math.min( + node.loc.end.line - 1, + node.params[node.params.length - 1].loc.end.line, + ); + if (node.params[0].loc.start.line !== endLine) + scriptLineRange.push([ + node.params[0].loc.start.line - 1, + endLine - 1, + ]); + } if (node.type === "SvelteMustacheTag") { if (node.loc.start.line !== node.loc.end.line) scriptLineRange.push([