diff --git a/.changeset/config.json b/.changeset/config.json index a6b9e318..4c9faa62 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -8,7 +8,7 @@ ], "commit": false, "linked": [], - "access": "restricted", + "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", "bumpVersionsWithWorkspaceProtocolOnly": true, diff --git a/.env-cmdrc b/.env-cmdrc deleted file mode 100644 index db5ffa1e..00000000 --- a/.env-cmdrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version-ci": { - "IN_VERSION_CI_SCRIPT": "true" - } -} diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml index a326867e..e64d4eb1 100644 --- a/.github/workflows/GHPages.yml +++ b/.github/workflows/GHPages.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install And Build @@ -38,7 +38,7 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: ./explorer-v2/build - name: Deploy to GitHub Pages diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 70490c12..618030da 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages @@ -25,7 +25,7 @@ jobs: matrix: node-version: [18.x, 20.x, 22.x, latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 @@ -38,7 +38,7 @@ jobs: test-for-svelte-v5: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - name: Use Node.js uses: actions/setup-node@v4 @@ -50,7 +50,7 @@ jobs: test-for-svelte-v4: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - name: Use Node.js uses: actions/setup-node@v4 @@ -69,7 +69,7 @@ jobs: matrix: node-version: [18.x] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 @@ -86,7 +86,7 @@ jobs: update-fixtures: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages @@ -100,7 +100,7 @@ jobs: test-and-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 5aa84503..14e85007 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -5,18 +5,20 @@ on: branches: - main -permissions: - contents: write - issues: write - pull-requests: write +permissions: {} jobs: release: + permissions: + contents: write + issues: write + pull-requests: write + id-token: write name: Release runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 @@ -26,7 +28,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 - + with: + node-version: 24 - name: Install Dependencies run: pnpm install @@ -42,4 +45,4 @@ jobs: title: "chore: release svelte-eslint-parser" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 1e60d6a8..d9c5894d 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -10,7 +10,7 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages diff --git a/.github/workflows/pkg.pr.new-comment.yml b/.github/workflows/pkg.pr.new-comment.yml index 788908ef..15ff5794 100644 --- a/.github/workflows/pkg.pr.new-comment.yml +++ b/.github/workflows/pkg.pr.new-comment.yml @@ -16,9 +16,9 @@ jobs: name: Update comment runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: output github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 27864d31..c412e2d2 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d6479ab..b73f631c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # svelte-eslint-parser +## 1.3.2 + +### Patch Changes + +- [#747](https://github.com/sveltejs/svelte-eslint-parser/pull/747) [`eddc3e3`](https://github.com/sveltejs/svelte-eslint-parser/commit/eddc3e39937bc33693096fe56abf3421d36a8181) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: internal function hasTypeInfo misjudging and providing insufficient type information in complex cases. + +## 1.3.1 + +### Patch Changes + +- [#732](https://github.com/sveltejs/svelte-eslint-parser/pull/732) [`1350734`](https://github.com/sveltejs/svelte-eslint-parser/commit/1350734793ad8cf86b660aa8e3337be3c48fb5d4) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: `$derived` argument expression to apply correct type information to `this` + +## 1.3.0 + +### Minor Changes + +- [#725](https://github.com/sveltejs/svelte-eslint-parser/pull/725) [`1710145`](https://github.com/sveltejs/svelte-eslint-parser/commit/1710145c2e9f3d87103276e8a8517997833aae6b) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: support asynchronous svelte + +## 1.2.0 + +### Minor Changes + +- [#714](https://github.com/sveltejs/svelte-eslint-parser/pull/714) [`855af3b`](https://github.com/sveltejs/svelte-eslint-parser/commit/855af3b9fe4dc94d0af025b0b443579fa6e2c507) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: support `{@attach ...}` + ## 1.1.3 ### Patch Changes diff --git a/README.md b/README.md index 1f6994ea..3853c3ab 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # svelte-eslint-parser -## [Svelte](https://svelte.dev/) parser for [ESLint](https://eslint.org/). +## [Svelte](https://svelte.dev/) parser for [ESLint](https://eslint.org/) [Live DEMO](https://sveltejs.github.io/svelte-eslint-parser/playground) • [Discord](https://svelte.dev/chat) @@ -100,7 +100,7 @@ export default [ parser: svelteParser, parserOptions: { sourceType: "module", - ecmaVersion: 2021, + ecmaVersion: 2024, ecmaFeatures: { globalReturn: false, impliedStrict: false, diff --git a/docs/AST.md b/docs/AST.md index c0f90492..c1d3f92d 100644 --- a/docs/AST.md +++ b/docs/AST.md @@ -169,6 +169,7 @@ interface SvelteStartTag extends Node { | SvelteAttribute | SvelteShorthandAttribute | SvelteSpreadAttribute + | SvelteAttachTag | SvelteDirective | SvelteStyleDirective | SvelteSpecialDirective @@ -451,6 +452,18 @@ interface SvelteRenderTag extends Node { } ``` +### SvelteAttachTag + +This is `{@attach}` tag node. + +```ts +export interface SvelteAttachTag extends BaseNode { + type: "SvelteAttachTag"; + expression: ESTree.Expression; + parent: SvelteStartTag; +} +``` + ### SvelteIfBlock This is the `{#if}` tag node. `{:else if}` is also included in this node. diff --git a/explorer-v2/package.json b/explorer-v2/package.json index 74e4f661..db6fcd2b 100644 --- a/explorer-v2/package.json +++ b/explorer-v2/package.json @@ -21,18 +21,18 @@ "svelte": "^5.2.12", "svelte-eslint-parser": "link:..", "tslib": "^2.8.1", - "vite-plugin-eslint4b": "^0.5.1" + "vite-plugin-eslint4b": "^0.6.0" }, "devDependencies": { "@sveltejs/adapter-static": "^3.0.6", "@sveltejs/kit": "^2.9.0", - "@sveltejs/vite-plugin-svelte": "^5.0.1", - "monaco-editor": "^0.52.0", + "@sveltejs/vite-plugin-svelte": "^6.0.0", + "monaco-editor": "^0.53.0", "prettier": "^3.4.1", "prettier-plugin-svelte": "^3.3.2", "string-replace-loader": "^3.1.0", "typescript": "^5.7.2", - "vite": "^6.0.1", + "vite": "^7.0.0", "webpack": "^5.96.1", "webpack-cli": "^6.0.0", "wrapper-webpack-plugin": "^2.2.2" diff --git a/explorer-v2/src/lib/ESLintEditor.svelte b/explorer-v2/src/lib/ESLintEditor.svelte index cc440f2c..8537401c 100644 --- a/explorer-v2/src/lib/ESLintEditor.svelte +++ b/explorer-v2/src/lib/ESLintEditor.svelte @@ -3,6 +3,7 @@ import MonacoEditor from './MonacoEditor.svelte'; import { loadMonacoEditor } from './scripts/monaco-loader'; import { createEventDispatcher, onMount } from 'svelte'; + import { SvelteMap } from 'svelte/reactivity'; const dispatch = createEventDispatcher(); @@ -16,7 +17,7 @@ let leftMarkers = []; let rightMarkers = []; - let messageMap = new Map(); + let messageMap = new SvelteMap(); $: showApplyFix = fix && fixedValue !== code; $: { diff --git a/explorer-v2/src/lib/ESLintPlayground.svelte b/explorer-v2/src/lib/ESLintPlayground.svelte index dacaa2d3..3f93c7d2 100644 --- a/explorer-v2/src/lib/ESLintPlayground.svelte +++ b/explorer-v2/src/lib/ESLintPlayground.svelte @@ -119,7 +119,7 @@ languageOptions: { parser: svelteEslintParser, parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2024, sourceType: 'module', parser: { ts: tsParser, typescript: tsParser } }, @@ -138,6 +138,7 @@ {#each messages as msg, i (`${msg.line}:${msg.column}:${msg.ruleId}@${i}`)}
loading...
+ {/snippet} +{await one()}
+{await two()}
\ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency1-output.json b/tests/fixtures/parser/ast/svelte5/async/concurrency1-output.json new file mode 100644 index 00000000..c785703c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency1-output.json @@ -0,0 +1,2773 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 66, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 59, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 47, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 41, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 41, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "range": [ + 111, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "range": [ + 35, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 23, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "range": [ + 17, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + ], + "range": [ + 11, + 125 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 198, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 184, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 177, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 165, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 159, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 159, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 229, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 13 + } + } + } + ], + "range": [ + 153, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 141, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "range": [ + 135, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "range": [ + 129, + 243 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 10, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 244, + 253 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 0, + 253 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 253, + 255 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 255, + 258 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "one", + "range": [ + 265, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 265, + 270 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 259, + 270 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 258, + 271 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 16 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 271, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + "range": [ + 255, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 276, + 279 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "two", + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 286, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + "range": [ + 280, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + "range": [ + 279, + 292 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 16 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 292, + 296 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + "range": [ + 276, + 296 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 20 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " artificial delay", + "range": [ + 87, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 50 + }, + "end": { + "line": 3, + "column": 69 + } + } + }, + { + "type": "Line", + "value": " artificial delay", + "range": [ + 205, + 224 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 8, + "column": 69 + } + } + } + ], + "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": "const", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 63, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + { + "type": "Numeric", + "value": "500", + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 46 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 48 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 129, + 134 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 150, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 159, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 181, + 183 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 8, + "column": 39 + }, + "end": { + "line": 8, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Numeric", + "value": "500", + "range": [ + 198, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 46 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 47 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 48 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 229, + 235 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 246, + 252 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 253, + 255 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 259, + 264 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 265, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 270, + 271 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 280, + 285 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 289, + 290 + ], + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 295, + 296 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + } + ], + "range": [ + 0, + 296 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 20 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency1-scope-output.json b/tests/fixtures/parser/ast/svelte5/async/concurrency1-scope-output.json new file mode 100644 index 00000000..6c27e9da --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency1-scope-output.json @@ -0,0 +1,2037 @@ +{ + "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": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "one", + "identifiers": [ + { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 66, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 59, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 47, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 41, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 41, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "range": [ + 111, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "range": [ + 35, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 23, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "range": [ + 17, + 124 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 265, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "two", + "identifiers": [ + { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 198, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 184, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 177, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 165, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 159, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 159, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 229, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 13 + } + } + } + ], + "range": [ + 153, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 141, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "range": [ + 135, + 242 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 265, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 286, + 289 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 135, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "f", + "identifiers": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 66, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 59, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "f", + "identifiers": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 198, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 184, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 177, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 66, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency2-input.svelte b/tests/fixtures/parser/ast/svelte5/async/concurrency2-input.svelte new file mode 100644 index 00000000..912fa31a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency2-input.svelte @@ -0,0 +1,19 @@ + + +{a}
+{b}
\ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency2-output.json b/tests/fixtures/parser/ast/svelte5/async/concurrency2-output.json new file mode 100644 index 00000000..84e3b220 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency2-output.json @@ -0,0 +1,3466 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 76, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 69, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 57, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 51, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 51, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "range": [ + 45, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 33, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "range": [ + 27, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + ], + "range": [ + 21, + 135 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 194, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 187, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 175, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 169, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 169, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 239, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 13 + } + } + } + ], + "range": [ + 163, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 151, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "range": [ + 145, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "range": [ + 139, + 253 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "one", + "range": [ + 364, + 367 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 364, + 369 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + "range": [ + 358, + 369 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 349, + 370 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + "range": [ + 345, + 370 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 31 + } + } + } + ], + "range": [ + 341, + 371 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "two", + "range": [ + 397, + 400 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 397, + 402 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "range": [ + 391, + 402 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 382, + 403 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + "range": [ + 378, + 403 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 31 + } + } + } + ], + "range": [ + 374, + 404 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 405, + 414 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "range": [ + 0, + 414 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 414, + 416 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 417, + 418 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 416, + 419 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + "range": [ + 419, + 422 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 6 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 422, + 426 + ], + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + "range": [ + 416, + 426 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 426, + 427 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 19, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 428, + 429 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 427, + 430 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 431, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + "range": [ + 430, + 433 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 6 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 433, + 437 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + "range": [ + 427, + 437 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 10 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " artificial delay", + "range": [ + 97, + 116 + ], + "loc": { + "start": { + "line": 3, + "column": 50 + }, + "end": { + "line": 3, + "column": 69 + } + } + }, + { + "type": "Line", + "value": " artificial delay", + "range": [ + 215, + 234 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 8, + "column": 69 + } + } + }, + { + "type": "Line", + "value": " these will run sequentially the first time,", + "range": [ + 257, + 303 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 48 + } + } + }, + { + "type": "Line", + "value": " but will update independently", + "range": [ + 306, + 338 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 34 + } + } + } + ], + "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": "const", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 51, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 57, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 73, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + { + "type": "Numeric", + "value": "500", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 46 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 47 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 48 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 121, + 127 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 139, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 151, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 160, + 162 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 169, + 174 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 175, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 191, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 8, + "column": 39 + }, + "end": { + "line": 8, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Numeric", + "value": "500", + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 46 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 47 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 48 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 239, + 245 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 341, + 344 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 357, + 358 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 358, + 363 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 364, + 367 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 367, + 368 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 368, + 369 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 374, + 377 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 380, + 381 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 390, + 391 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 391, + 396 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 397, + 400 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 400, + 401 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 401, + 402 + ], + "loc": { + "start": { + "line": 15, + "column": 29 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 402, + 403 + ], + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 403, + 404 + ], + "loc": { + "start": { + "line": 15, + "column": 31 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 407, + 413 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 414, + 416 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 416, + 417 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 417, + 418 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 418, + 419 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 419, + 420 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 421, + 422 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 422, + 423 + ], + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 423, + 424 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 424, + 425 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 425, + 426 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 426, + 427 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 19, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 427, + 428 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 428, + 429 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 429, + 430 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 430, + 431 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 431, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 432, + 433 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 433, + 434 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 434, + 435 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 435, + 436 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 436, + 437 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + } + } + ], + "range": [ + 0, + 437 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 19, + "column": 10 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency2-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/async/concurrency2-prefer-const-result.json new file mode 100644 index 00000000..dcaaa316 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency2-prefer-const-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "prefer-const", + "code": "a", + "line": 14, + "column": 7 + }, + { + "ruleId": "prefer-const", + "code": "b", + "line": 15, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/concurrency2-scope-output.json b/tests/fixtures/parser/ast/svelte5/async/concurrency2-scope-output.json new file mode 100644 index 00000000..05e77c8b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/concurrency2-scope-output.json @@ -0,0 +1,2846 @@ +{ + "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": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "one", + "identifiers": [ + { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 76, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 69, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 57, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 51, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 48 + } + } + }, + "range": [ + 51, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "range": [ + 45, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 33, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "range": [ + 27, + 134 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 364, + 367 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "two", + "identifiers": [ + { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "init": { + "type": "ArrowFunctionExpression", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 194, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 187, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 175, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 169, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 169, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 239, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 13 + } + } + } + ], + "range": [ + 163, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 151, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "range": [ + 145, + 252 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 397, + 400 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + } + ] + }, + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "one", + "range": [ + 364, + 367 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 364, + 369 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + "range": [ + 358, + 369 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 349, + 370 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + "range": [ + 345, + 370 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 31 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "two", + "range": [ + 397, + 400 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + "optional": false, + "range": [ + 397, + 402 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "range": [ + 391, + 402 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 382, + 403 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + "range": [ + 378, + 403 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 31 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 431, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "one", + "range": [ + 364, + 367 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "one", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "two", + "range": [ + 397, + 400 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "two", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 431, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "f", + "identifiers": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 43 + }, + "end": { + "line": 3, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 76, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + ], + "range": [ + 69, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "f", + "identifiers": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 208, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 46 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 194, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 47 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + ], + "range": [ + 187, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 349, + 357 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 382, + 390 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 76, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 179, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 194, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-input.svelte b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-input.svelte new file mode 100644 index 00000000..6adf7693 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-input.svelte @@ -0,0 +1,14 @@ + + + + + +{a} + {b} = {await add(a, b)}
diff --git a/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-output.json b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-output.json new file mode 100644 index 00000000..8c2f3c70 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-output.json @@ -0,0 +1,3481 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 10, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 38, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "range": [ + 30, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "FunctionDeclaration", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 105, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 98, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 45 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 86, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 155, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 148, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 76, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + ], + "range": [ + 51, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 165, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 174 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 177, + 182 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "type", + "range": [ + 183, + 187 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "number", + "range": [ + 189, + 195 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + } + } + } + ], + "range": [ + 183, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "value", + "range": [ + 202, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "modifiers": [], + "range": [ + 197, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + "shorthand": false, + "range": [ + 197, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 35 + } + } + } + ], + "selfClosing": false, + "range": [ + 176, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 36 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 176, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 36 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 11, + "column": 36 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 214, + 219 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "type", + "range": [ + 220, + 224 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "number", + "range": [ + 226, + 232 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + } + ], + "range": [ + 220, + 233 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "value", + "range": [ + 239, + 244 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + "modifiers": [], + "range": [ + 234, + 244 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + "shorthand": false, + "range": [ + 234, + 248 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 35 + } + } + } + ], + "selfClosing": false, + "range": [ + 213, + 249 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 213, + 249 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 249, + 251 + ], + "loc": { + "start": { + "line": 12, + "column": 36 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 251, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + "range": [ + 254, + 257 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": " + ", + "range": [ + 257, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "range": [ + 260, + 263 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "SvelteText", + "value": " = ", + "range": [ + 263, + 266 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 273, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "optional": false, + "range": [ + 273, + 282 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + "range": [ + 267, + 282 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + "range": [ + 266, + 283 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 283, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 36 + } + } + }, + "range": [ + 251, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 36 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " artificial delay", + "range": [ + 126, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 67 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 51, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 80, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 102, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 37 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + { + "type": "Numeric", + "value": "500", + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 44 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 45 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 46 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 167, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 177, + 182 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "type", + "range": [ + 183, + 187 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "number", + "range": [ + 189, + 195 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 197, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "value", + "range": [ + 202, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 36 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 11, + "column": 36 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 214, + 219 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "type", + "range": [ + 220, + 224 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "number", + "range": [ + 226, + 232 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 234, + 238 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "value", + "range": [ + 239, + 244 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 12, + "column": 31 + }, + "end": { + "line": 12, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 12, + "column": 34 + }, + "end": { + "line": 12, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 249, + 251 + ], + "loc": { + "start": { + "line": 12, + "column": 36 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "+", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 267, + 272 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 273, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 14, + "column": 33 + }, + "end": { + "line": 14, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 285, + 286 + ], + "loc": { + "start": { + "line": 14, + "column": 34 + }, + "end": { + "line": 14, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 14, + "column": 35 + }, + "end": { + "line": 14, + "column": 36 + } + } + } + ], + "range": [ + 0, + 288 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-scope-output.json b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-scope-output.json new file mode 100644 index 00000000..4f456b04 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/async/synchronized-updates-scope-output.json @@ -0,0 +1,3061 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 38, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ] + }, + { + "name": "add", + "identifiers": [ + { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 105, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 98, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 45 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 86, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 155, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 148, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 76, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + ], + "range": [ + 51, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 273, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 273, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 105, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 98, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 45 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 86, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 155, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 148, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 76, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + ], + "range": [ + 51, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": true, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "NewExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 105, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 98, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 45 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 86, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 46 + } + } + }, + "range": [ + 80, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 155, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 148, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 76, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + ], + "range": [ + 51, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "f", + "identifiers": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "Literal", + "raw": "500", + "value": 500, + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 44 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 105, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 98, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 45 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "f", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "f", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "Promise", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "setTimeout", + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/attach-ts-01-input.svelte b/tests/fixtures/parser/ast/svelte5/attach-ts-01-input.svelte new file mode 100644 index 00000000..e1bc8a5b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/attach-ts-01-input.svelte @@ -0,0 +1,14 @@ + + +{a} + {b} = {await add(a, b)}
+ +{#if $effect.pending()} +pending promises: {$effect.pending()}
+{/if} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-no-undef-result.json new file mode 100644 index 00000000..3cd3e56b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-no-undef-result.json @@ -0,0 +1,44 @@ +[ + { + "ruleId": "no-undef", + "code": "a", + "line": 1, + "column": 24 + }, + { + "ruleId": "no-undef", + "code": "b", + "line": 2, + "column": 24 + }, + { + "ruleId": "no-undef", + "code": "a", + "line": 4, + "column": 5 + }, + { + "ruleId": "no-undef", + "code": "b", + "line": 4, + "column": 11 + }, + { + "ruleId": "no-undef", + "code": "add", + "line": 4, + "column": 23 + }, + { + "ruleId": "no-undef", + "code": "a", + "line": 4, + "column": 27 + }, + { + "ruleId": "no-undef", + "code": "b", + "line": 4, + "column": 30 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-output.json new file mode 100644 index 00000000..600f2df7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-output.json @@ -0,0 +1,2755 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 8, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "a++", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 31, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 49, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 58, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 57, + 68 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "range": [ + 49, + 68 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 41, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "b++", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 72, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 41, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 81, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 4, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": " + ", + "range": [ + 89, + 92 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 92, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "SvelteText", + "value": " = ", + "range": [ + 95, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "AwaitExpression", + "argument": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "optional": false, + "range": [ + 105, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + "range": [ + 99, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + "range": [ + 98, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 115, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 32 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + "range": [ + 83, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "pending", + "range": [ + 134, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "range": [ + 126, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 126, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 146, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "pending promises: ", + "range": [ + 149, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "pending", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 38 + } + } + }, + "range": [ + 168, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 38 + } + } + }, + "optional": false, + "range": [ + 168, + 185 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 40 + } + } + }, + "range": [ + 167, + 186 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 186, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 41 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + "range": [ + 146, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 45 + } + } + } + ], + "else": null, + "range": [ + 121, + 196 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "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": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "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": "a++", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 49, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 61, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "HTMLText", + "value": "b++", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 81, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 4, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "+", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 99, + 104 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 4, + "column": 32 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 119, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 122, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "pending", + "range": [ + 134, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "pending", + "range": [ + 149, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": "promises:", + "range": [ + 157, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 30 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "pending", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 7, + "column": 38 + }, + "end": { + "line": 7, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 7, + "column": 40 + }, + "end": { + "line": 7, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 7, + "column": 41 + }, + "end": { + "line": 7, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 42 + }, + "end": { + "line": 7, + "column": 43 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 7, + "column": 43 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 192, + 195 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + ], + "range": [ + 0, + 196 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-scope-output.json new file mode 100644 index 00000000..18171a98 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pending-scope-output.json @@ -0,0 +1,798 @@ +{ + "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": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + } + ] + }, + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json index 0b52ca4c..69669535 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json @@ -1188,7 +1188,7 @@ } }, { - "type": "Keyword", + "type": "Identifier", "value": "with", "range": [ 63, diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json index 3a146be6..e247f41f 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json @@ -811,7 +811,7 @@ } }, { - "type": "Keyword", + "type": "Identifier", "value": "with", "range": [ 63, 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 index 0db3e719..ab40edd8 100644 --- 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 @@ -3,8 +3,8 @@ let { data, children, row }: { // data: any[], data: any[], children: Snippet<[]>, children: Snippet<[]>, row: Snippet<[any]>, row: Snippet<[any]> data: any[]; // data: any[] - children: Snippet; // Snippet: Snippet