diff --git a/src/parser/converts/attr.ts b/src/parser/converts/attr.ts index 912eb4fc..3323ba52 100644 --- a/src/parser/converts/attr.ts +++ b/src/parser/converts/attr.ts @@ -495,7 +495,7 @@ function convertLetDirective( ...ctx.getConvertLocation(node), } processDirective(node, directive, ctx, { - processExpression(pattern) { + processPattern(pattern) { return ctx.letDirCollections .getCollection() .addPattern(pattern, directive, "any") @@ -515,6 +515,32 @@ function convertLetDirective( return directive } +type DirectiveProcessors< + D extends SvAST.Directive, + S extends SvelteDirective, + E extends D["expression"] & S["expression"], +> = + | { + processExpression: ( + expression: E, + shorthand: boolean, + ) => ScriptLetCallback>[] + processPattern?: undefined + processName?: ( + expression: SvelteName, + ) => ScriptLetCallback[] + } + | { + processExpression?: undefined + processPattern: ( + expression: E, + shorthand: boolean, + ) => ScriptLetCallback>[] + processName?: ( + expression: SvelteName, + ) => ScriptLetCallback[] + } + /** Common process for directive */ function processDirective< D extends SvAST.Directive, @@ -524,15 +550,7 @@ function processDirective< node: D & { expression: null | E }, directive: S, ctx: Context, - processors: { - processExpression: ( - expression: E, - shorthand: boolean, - ) => ScriptLetCallback>[] - processName?: ( - expression: SvelteName, - ) => ScriptLetCallback[] - }, + processors: DirectiveProcessors, ) { processDirectiveKey(node, directive, ctx) processDirectiveExpression(node, directive, ctx, processors) @@ -609,15 +627,7 @@ function processDirectiveExpression< node: D & { expression: null | E }, directive: S, ctx: Context, - processors: { - processExpression: ( - expression: E, - shorthand: boolean, - ) => ScriptLetCallback>[] - processName?: ( - expression: SvelteName, - ) => ScriptLetCallback[] - }, + processors: DirectiveProcessors, ) { const key = directive.key const keyName = key.name as SvelteName @@ -633,16 +643,24 @@ function processDirectiveExpression< // e.g. bind:value="" getWithLoc(node.expression).end = keyName.range[1] } - processors.processExpression(node.expression, shorthand).push((es) => { - if (node.expression && es.type !== node.expression.type) { - throw new ParseError( - `Expected ${node.expression.type}, but ${es.type} found.`, - es.range![0], - ctx, - ) - } - directive.expression = es - }) + if (processors.processExpression) { + processors + .processExpression(node.expression, shorthand) + .push((es) => { + if (node.expression && es.type !== node.expression.type) { + throw new ParseError( + `Expected ${node.expression.type}, but ${es.type} found.`, + es.range![0], + ctx, + ) + } + directive.expression = es + }) + } else { + processors.processPattern(node.expression, shorthand).push((es) => { + directive.expression = es + }) + } } if (!shorthand) { if (processors.processName) { diff --git a/tests/fixtures/parser/ast/let-directive02-input.svelte b/tests/fixtures/parser/ast/let-directive02-input.svelte new file mode 100644 index 00000000..28fcf279 --- /dev/null +++ b/tests/fixtures/parser/ast/let-directive02-input.svelte @@ -0,0 +1,7 @@ + + + +
+ diff --git a/tests/fixtures/parser/ast/let-directive02-output.json b/tests/fixtures/parser/ast/let-directive02-output.json new file mode 100644 index 00000000..33db01f2 --- /dev/null +++ b/tests/fixtures/parser/ast/let-directive02-output.json @@ -0,0 +1,1279 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'./Hoverable.svelte'", + "value": "./Hoverable.svelte", + "range": [ + 32, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "range": [ + 10, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 44 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 54, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 63, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Let", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "hovering", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "modifiers": [], + "range": [ + 76, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "expression": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 92, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "range": [ + 92, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 37 + } + } + } + ], + "range": [ + 91, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + "range": [ + 76, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 40 + } + } + } + ], + "selfClosing": false, + "range": [ + 65, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 106, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 109, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Class", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "modifiers": [], + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "expression": { + "type": "Identifier", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "shorthand": true, + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 18 + } + } + } + ], + "selfClosing": true, + "range": [ + 108, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 108, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 129, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "range": [ + 65, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "String", + "value": "'./Hoverable.svelte'", + "range": [ + 32, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 56, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 63, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Hoverable", + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "let", + "range": [ + 76, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "hovering", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 92, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 40 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 106, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 109, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "class", + "range": [ + 113, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "Hoverable", + "range": [ + 131, + 140 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "range": [ + 0, + 142 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/let-directive02-scope-output.json b/tests/fixtures/parser/ast/let-directive02-scope-output.json new file mode 100644 index 00000000..98dd33c3 --- /dev/null +++ b/tests/fixtures/parser/ast/let-directive02-scope-output.json @@ -0,0 +1,709 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Hoverable", + "identifiers": [ + { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "node": { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "active", + "identifiers": [ + { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "node": { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Hoverable", + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Let", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "hovering", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "modifiers": [], + "range": [ + 76, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "expression": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 92, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "range": [ + 92, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 37 + } + } + } + ], + "range": [ + 91, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + "range": [ + 76, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 40 + } + } + } + ], + "selfClosing": false, + "range": [ + 65, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 106, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 109, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Class", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "modifiers": [], + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "expression": { + "type": "Identifier", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "shorthand": true, + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 18 + } + } + } + ], + "selfClosing": true, + "range": [ + 108, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 108, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 129, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "range": [ + 65, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "active", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "active", + "range": [ + 96, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 37 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file