From d9966ee843c4009ac554bae4eb8f407636f040a7 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 23 Dec 2018 22:30:35 +0100 Subject: [PATCH 1/6] Fix: sourceType not correctly set in AST when provided in options. --- .gitignore | 1 + parser.js | 4 ++++ tests/lib/scope-analysis.js | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/.gitignore b/.gitignore index 5f01791..34a9c5a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ _test.js .vscode yarn.lock .eslint-release-info.json +.idea diff --git a/parser.js b/parser.js index 59f5836..4b71d4b 100644 --- a/parser.js +++ b/parser.js @@ -34,6 +34,10 @@ exports.parseForESLint = function parseForESLint(code, options) { } const ast = parse(code, options); + if (options.sourceType && ast && ast.type === "Program") { + ast.sourceType = options.sourceType; + } + const extraOptions = { sourceType: ast.sourceType }; diff --git a/tests/lib/scope-analysis.js b/tests/lib/scope-analysis.js index f56714b..3afd42c 100644 --- a/tests/lib/scope-analysis.js +++ b/tests/lib/scope-analysis.js @@ -370,4 +370,26 @@ function test(file: Blob) { expect(messages).toStrictEqual([]); }); + + test("https://github.com/bradzacher/eslint-plugin-typescript/issues/255", () => { + const code = ` +window.whatevs = { + myFunc() { + console.log('yep'); + } +}; +`; + const config = { + parser: "typescript-eslint-parser", + parserOptions: { + sourceType: "module", + }, + rules: { + strict: "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue255.ts" }); + + expect(messages).toStrictEqual([]); + }); }); From 2e8496caf5e46f2c2d39daa46d5a11ed62d413b9 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 23 Dec 2018 23:12:22 +0100 Subject: [PATCH 2/6] chore: fix linting --- tests/lib/scope-analysis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/scope-analysis.js b/tests/lib/scope-analysis.js index 3afd42c..1455502 100644 --- a/tests/lib/scope-analysis.js +++ b/tests/lib/scope-analysis.js @@ -382,7 +382,7 @@ window.whatevs = { const config = { parser: "typescript-eslint-parser", parserOptions: { - sourceType: "module", + sourceType: "module" }, rules: { strict: "error" From e6559570f41902cfb021a1f9daee219c757e0a27 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 13 Jan 2019 03:16:17 +0100 Subject: [PATCH 3/6] fix: simplify sourceType --- analyze-scope.js | 6 +++--- parser.js | 24 +++++++----------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/analyze-scope.js b/analyze-scope.js index 5505973..f911769 100644 --- a/analyze-scope.js +++ b/analyze-scope.js @@ -778,17 +778,17 @@ class Referencer extends OriginalReferencer { } } -module.exports = function(ast, parserOptions, extraOptions) { +module.exports = function(ast, parserOptions) { const options = { ignoreEval: true, optimistic: false, directive: false, nodejsScope: - ast.sourceType === "script" && + parserOptions.sourceType === "script" && (parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, - sourceType: extraOptions.sourceType, + sourceType: parserOptions.sourceType, ecmaVersion: parserOptions.ecmaVersion || 2018, childVisitorKeys, fallback diff --git a/parser.js b/parser.js index dccfe74..966c28a 100644 --- a/parser.js +++ b/parser.js @@ -34,14 +34,15 @@ exports.parseForESLint = function parseForESLint(code, options) { } const ast = parse(code, options); - if (options.sourceType && ast && ast.type === "Program") { + + // https://eslint.org/docs/user-guide/configuring#specifying-parser-options + // if sourceType is not provided by default eslint expect that it will be set to "script" + options.sourceType = options.sourceType || "script"; + + if (ast && ast.type === "Program") { ast.sourceType = options.sourceType; } - const extraOptions = { - sourceType: ast.sourceType - }; - traverser.traverse(ast, { enter: node => { switch (node.type) { @@ -51,23 +52,12 @@ exports.parseForESLint = function parseForESLint(code, options) { node.type = `TSEmptyBody${node.type}`; } break; - - // Import/Export declarations cannot appear in script. - // But if those appear only in namespace/module blocks, `ast.sourceType` was `"script"`. - // This doesn't modify `ast.sourceType` directly for backward compatibility. - case "ImportDeclaration": - case "ExportAllDeclaration": - case "ExportDefaultDeclaration": - case "ExportNamedDeclaration": - extraOptions.sourceType = "module"; - break; - // no default } } }); - const scopeManager = analyzeScope(ast, options, extraOptions); + const scopeManager = analyzeScope(ast, options); return { ast, scopeManager, visitorKeys }; }; From 5d69c769bb6491bd5f322692b26e7f22eec7251f Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 13 Jan 2019 03:23:35 +0100 Subject: [PATCH 4/6] fix: add missing validation of sourceType --- parser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/parser.js b/parser.js index 966c28a..dec3cd6 100644 --- a/parser.js +++ b/parser.js @@ -33,16 +33,16 @@ exports.parseForESLint = function parseForESLint(code, options) { } } - const ast = parse(code, options); - // https://eslint.org/docs/user-guide/configuring#specifying-parser-options // if sourceType is not provided by default eslint expect that it will be set to "script" options.sourceType = options.sourceType || "script"; - - if (ast && ast.type === "Program") { - ast.sourceType = options.sourceType; + if (options.sourceType !== "module" && options.sourceType !== "script") { + options.sourceType = "script"; } + const ast = parse(code, options); + ast.sourceType = options.sourceType; + traverser.traverse(ast, { enter: node => { switch (node.type) { From 99bea43d4efdc6bfcd50356862e2f8c4028e5a12 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 13 Jan 2019 03:40:42 +0100 Subject: [PATCH 5/6] test: add scope analysis for both script and module. --- tests/lib/__snapshots__/basics.js.snap | 18 +- tests/lib/__snapshots__/comments.js.snap | 40 +- tests/lib/__snapshots__/ecma-features.js.snap | 484 +- tests/lib/__snapshots__/jsx.js.snap | 48 +- .../lib/__snapshots__/scope-analysis.js.snap | 32887 +++++++++++++--- tests/lib/__snapshots__/tsx.js.snap | 2 +- tests/lib/__snapshots__/typescript.js.snap | 224 +- tests/lib/comments.js | 3 +- tests/lib/scope-analysis.js | 94 +- tools/test-utils.js | 3 +- 10 files changed, 27513 insertions(+), 6290 deletions(-) diff --git a/tests/lib/__snapshots__/basics.js.snap b/tests/lib/__snapshots__/basics.js.snap index d952c5a..6aeaa22 100644 --- a/tests/lib/__snapshots__/basics.js.snap +++ b/tests/lib/__snapshots__/basics.js.snap @@ -109,7 +109,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -515,7 +515,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1194,7 +1194,7 @@ Object { 0, 60, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1562,7 +1562,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1731,7 +1731,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1993,7 +1993,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2236,7 +2236,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2537,7 +2537,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2997,7 +2997,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/__snapshots__/comments.js.snap b/tests/lib/__snapshots__/comments.js.snap index 5672625..cf52cd5 100644 --- a/tests/lib/__snapshots__/comments.js.snap +++ b/tests/lib/__snapshots__/comments.js.snap @@ -110,7 +110,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -335,7 +335,7 @@ Object { 10, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -984,7 +984,7 @@ Object { 99, 137, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1489,7 +1489,7 @@ Object { 0, 98, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2193,7 +2193,7 @@ Object { 0, 129, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2598,7 +2598,7 @@ Object { 12, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [], "type": "Program", } @@ -2752,7 +2752,7 @@ Object { 6, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2946,7 +2946,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3204,7 +3204,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3504,7 +3504,7 @@ Object { 0, 61, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3822,7 +3822,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4105,7 +4105,7 @@ Object { 0, 62, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4406,7 +4406,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4799,7 +4799,7 @@ Object { 0, 69, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5297,7 +5297,7 @@ Object { 0, 92, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5890,7 +5890,7 @@ Object { 0, 142, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6442,7 +6442,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6911,7 +6911,7 @@ Object { 0, 134, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7996,7 +7996,7 @@ Object { 0, 288, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9115,7 +9115,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/__snapshots__/ecma-features.js.snap b/tests/lib/__snapshots__/ecma-features.js.snap index 591436e..570124e 100644 --- a/tests/lib/__snapshots__/ecma-features.js.snap +++ b/tests/lib/__snapshots__/ecma-features.js.snap @@ -113,7 +113,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -432,7 +432,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -732,7 +732,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1074,7 +1074,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1645,7 +1645,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1945,7 +1945,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2210,7 +2210,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2540,7 +2540,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2878,7 +2878,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3234,7 +3234,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3536,7 +3536,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3802,7 +3802,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4104,7 +4104,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4442,7 +4442,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4780,7 +4780,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5100,7 +5100,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5348,7 +5348,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5578,7 +5578,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5826,7 +5826,7 @@ Object { 0, 9, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6095,7 +6095,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6396,7 +6396,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6697,7 +6697,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6998,7 +6998,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7173,7 +7173,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7366,7 +7366,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7613,7 +7613,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7865,7 +7865,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8189,7 +8189,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8652,7 +8652,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8827,7 +8827,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9037,7 +9037,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9207,7 +9207,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9305,7 +9305,7 @@ Object { 0, 4, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9403,7 +9403,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9501,7 +9501,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9601,7 +9601,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9699,7 +9699,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9834,7 +9834,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10023,7 +10023,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10306,7 +10306,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10867,7 +10867,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11385,7 +11385,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11717,7 +11717,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12001,7 +12001,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12357,7 +12357,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12714,7 +12714,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13052,7 +13052,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13461,7 +13461,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13889,7 +13889,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14282,7 +14282,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14692,7 +14692,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15259,7 +15259,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15981,7 +15981,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -16631,7 +16631,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17157,7 +17157,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17717,7 +17717,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18259,7 +18259,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18837,7 +18837,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19397,7 +19397,7 @@ Object { 0, 56, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19879,7 +19879,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20255,7 +20255,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20647,7 +20647,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20980,7 +20980,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21258,7 +21258,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21499,7 +21499,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21686,7 +21686,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21873,7 +21873,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22096,7 +22096,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22302,7 +22302,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22550,7 +22550,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22847,7 +22847,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23088,7 +23088,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23464,7 +23464,7 @@ Object { 0, 47, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23894,7 +23894,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24248,7 +24248,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24584,7 +24584,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24996,7 +24996,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25460,7 +25460,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25901,7 +25901,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26216,7 +26216,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26550,7 +26550,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26909,7 +26909,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27448,7 +27448,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28137,7 +28137,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28754,7 +28754,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29221,7 +29221,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29760,7 +29760,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30449,7 +30449,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31066,7 +31066,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31470,7 +31470,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31858,7 +31858,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -32529,7 +32529,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -33133,7 +33133,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -33594,7 +33594,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34055,7 +34055,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34482,7 +34482,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35005,7 +35005,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35504,7 +35504,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36081,7 +36081,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36802,7 +36802,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37451,7 +37451,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38028,7 +38028,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38606,7 +38606,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39220,7 +39220,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39908,7 +39908,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40869,7 +40869,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41657,7 +41657,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42064,7 +42064,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42497,7 +42497,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -43358,7 +43358,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44037,7 +44037,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44374,7 +44374,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44675,7 +44675,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45069,7 +45069,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45631,7 +45631,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46147,7 +46147,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46519,7 +46519,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46966,7 +46966,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47359,7 +47359,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47939,7 +47939,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48533,7 +48533,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48983,7 +48983,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49370,7 +49370,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49653,7 +49653,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49955,7 +49955,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50446,7 +50446,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50973,7 +50973,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51457,7 +51457,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51758,7 +51758,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52116,7 +52116,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52662,7 +52662,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53158,7 +53158,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53420,7 +53420,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53721,7 +53721,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54058,7 +54058,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54359,7 +54359,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54696,7 +54696,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55033,7 +55033,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55575,7 +55575,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56193,7 +56193,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56651,7 +56651,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57079,7 +57079,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57501,7 +57501,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57945,7 +57945,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58517,7 +58517,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58902,7 +58902,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59197,7 +59197,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59591,7 +59591,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60033,7 +60033,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60438,7 +60438,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60753,7 +60753,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60980,7 +60980,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -61318,7 +61318,7 @@ Object { 0, 70, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -61795,7 +61795,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62170,7 +62170,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62669,7 +62669,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -63077,7 +63077,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -63508,7 +63508,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -64224,7 +64224,7 @@ Object { 0, 49, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65141,7 +65141,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65920,7 +65920,7 @@ Object { 0, 109, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66611,7 +66611,7 @@ Object { 0, 114, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -67330,7 +67330,7 @@ Object { 0, 70, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68049,7 +68049,7 @@ Object { 0, 80, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68674,7 +68674,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69227,7 +69227,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69721,7 +69721,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69944,7 +69944,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -70315,7 +70315,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -70815,7 +70815,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -71419,7 +71419,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -71824,7 +71824,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72193,7 +72193,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72562,7 +72562,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72897,7 +72897,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -73178,7 +73178,7 @@ Object { 1, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -73591,7 +73591,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74107,7 +74107,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74423,7 +74423,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74721,7 +74721,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75056,7 +75056,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75392,7 +75392,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75747,7 +75747,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76119,7 +76119,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76360,7 +76360,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76458,7 +76458,7 @@ Object { 0, 8, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76556,7 +76556,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -77266,7 +77266,7 @@ Object { 0, 43, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89169,7 +89169,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89487,7 +89487,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89895,7 +89895,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -90324,7 +90324,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -90736,7 +90736,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -91227,7 +91227,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -91799,7 +91799,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92154,7 +92154,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92476,7 +92476,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92814,7 +92814,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -93171,7 +93171,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -93747,7 +93747,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -94451,7 +94451,7 @@ Object { 0, 85, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -95082,7 +95082,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -95607,7 +95607,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96094,7 +96094,7 @@ Object { 0, 51, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96540,7 +96540,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96932,7 +96932,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -97324,7 +97324,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -97735,7 +97735,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -98146,7 +98146,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -98560,7 +98560,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99211,7 +99211,7 @@ Object { 0, 67, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99599,7 +99599,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99734,7 +99734,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99868,7 +99868,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100008,7 +100008,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100206,7 +100206,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100404,7 +100404,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100602,7 +100602,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100800,7 +100800,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101048,7 +101048,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101441,7 +101441,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101834,7 +101834,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102151,7 +102151,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102486,7 +102486,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102841,7 +102841,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103214,7 +103214,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103642,7 +103642,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103976,7 +103976,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104275,7 +104275,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104552,7 +104552,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104811,7 +104811,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105205,7 +105205,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105470,7 +105470,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105631,7 +105631,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106072,7 +106072,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106491,7 +106491,7 @@ Object { 0, 111, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106617,7 +106617,7 @@ Object { 0, 5, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106776,7 +106776,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106986,7 +106986,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107407,7 +107407,7 @@ Object { 0, 76, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107830,7 +107830,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107929,7 +107929,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/__snapshots__/jsx.js.snap b/tests/lib/__snapshots__/jsx.js.snap index 0f11194..08c6203 100644 --- a/tests/lib/__snapshots__/jsx.js.snap +++ b/tests/lib/__snapshots__/jsx.js.snap @@ -306,7 +306,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1052,7 +1052,7 @@ Object { 0, 60, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1657,7 +1657,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2136,7 +2136,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2705,7 +2705,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3107,7 +3107,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3782,7 +3782,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4467,7 +4467,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4746,7 +4746,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5111,7 +5111,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5586,7 +5586,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6027,7 +6027,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6290,7 +6290,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6612,7 +6612,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7039,7 +7039,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7462,7 +7462,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7813,7 +7813,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8178,7 +8178,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8667,7 +8667,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9108,7 +9108,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9547,7 +9547,7 @@ Object { 0, 54, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10025,7 +10025,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10401,7 +10401,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10790,7 +10790,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/__snapshots__/scope-analysis.js.snap b/tests/lib/__snapshots__/scope-analysis.js.snap index 561adcd..b7298d5 100644 --- a/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/tests/lib/__snapshots__/scope-analysis.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/535.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/535.ts 1`] = ` Object { - "$id": 5, + "$id": 6, "block": Object { "range": Array [ 0, @@ -12,75 +12,149 @@ Object { }, "childScopes": Array [ Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, - 51, + 52, ], - "type": "FunctionDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 3, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "bar", + "$id": 4, + "block": Object { "range": Array [ - 45, - 48, + 0, + 51, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, - "kind": "r", - "resolved": Object { - "$ref": 2, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, }, - "writeExpr": undefined, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 5, + "$ref": 6, }, "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - "bar": Object { - "$ref": 2, + "foo": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 4, + "$ref": 5, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "bar", + "name": "foo", "range": Array [ - 15, - 18, + 9, + 12, ], "type": "Identifier", }, @@ -92,28 +166,24 @@ Object { "type": "FunctionDeclaration", }, "parent": null, - "type": "Parameter", + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "bar", + "name": "foo", "range": Array [ - 15, - 18, + 9, + 12, ], "type": "Identifier", }, ], - "name": "bar", - "references": Array [ - Object { - "$ref": 3, - }, - ], + "name": "foo", + "references": Array [], "scope": Object { - "$ref": 4, + "$ref": 5, }, }, ], @@ -125,62 +195,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 5, + "$ref": 6, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, @@ -190,73 +215,98 @@ Object { }, "childScopes": Array [ Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 68, + 69, ], - "type": "TSAbstractClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "A": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, + "type": "Program", }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 68, - ], - "type": "TSAbstractClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ Object { - "name": "A", - "range": Array [ - 15, - 16, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], }, ], "functionExpressionScope": false, @@ -267,15 +317,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 3, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-implements.ts 1`] = ` Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, @@ -285,26 +335,96 @@ Object { }, "childScopes": Array [ Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, - 82, + 83, ], - "type": "ClassDeclaration", + "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 4, }, "variableMap": Object { "Foo": Object { - "$ref": 1, + "$ref": 0, }, }, "variableScope": Object { @@ -312,7 +432,7 @@ Object { }, "variables": Array [ Object { - "$id": 1, + "$id": 0, "defs": Array [ Object { "name": Object { @@ -330,7 +450,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -348,7 +468,7 @@ Object { "name": "Foo", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 3, }, }, ], @@ -360,62 +480,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 4, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-properties.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -425,72 +500,192 @@ Object { }, "childScopes": Array [ Object { - "$id": 7, + "$id": 8, "block": Object { "range": Array [ - 19, - 62, + 0, + 63, ], - "type": "ClassDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 5, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "s", + "$id": 7, + "block": Object { "range": Array [ - 43, - 44, + 19, + 62, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 7, + "type": "ClassDeclaration", }, - "identifier": Object { - "name": "s", - "range": Array [ - 50, - 51, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, ], "type": "Identifier", }, - "kind": "r", + "kind": "w", "resolved": Object { "$ref": 0, }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, "writeExpr": undefined, }, ], "throughReferences": Array [ Object { - "$ref": 5, - }, - Object { - "$ref": 6, + "$ref": 3, }, ], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 8, + "$ref": 9, }, "variableMap": Object { "A": Object { - "$ref": 4, + "$ref": 1, + }, + "s": Object { + "$ref": 0, }, }, "variableScope": Object { @@ -498,7 +693,63 @@ Object { }, "variables": Array [ Object { - "$id": 4, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, "defs": Array [ Object { "name": Object { @@ -516,7 +767,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -534,7 +785,7 @@ Object { "name": "A", "references": Array [], "scope": Object { - "$ref": 7, + "$ref": 8, }, }, ], @@ -542,50 +793,7 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 18, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 10, - 16, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [ Object { "$ref": 3, @@ -593,121 +801,17 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object { - "A": Object { - "$ref": 1, - }, - "s": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 8, + "$ref": 9, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 18, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "s", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 62, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` Object { - "$id": 11, + "$id": 12, "block": Object { "range": Array [ 0, @@ -717,95 +821,299 @@ Object { }, "childScopes": Array [ Object { - "$id": 6, + "$id": 11, "block": Object { "range": Array [ 0, - 40, + 117, ], - "type": "TSAbstractClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 11, + "type": "Program", }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 5, - "defs": Array [ + "$id": 6, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ Object { - "name": Object { - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 40, - ], - "type": "TSAbstractClassDeclaration", + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 6, }, - "parent": undefined, - "type": "ClassName", }, ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + Object { + "$id": 8, + "block": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ Object { - "name": "Foo", - "range": Array [ - 15, - 18, + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 8, + }, }, ], - "name": "Foo", + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, "references": Array [], - "scope": Object { - "$ref": 6, + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo3": Object { + "$ref": 9, + }, }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], }, ], - }, - Object { - "$id": 8, - "block": Object { - "range": Array [ - 42, - 82, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "module", "upperScope": Object { - "$ref": 11, + "$ref": 12, }, "variableMap": Object { "Foo2": Object { - "$ref": 7, + "$ref": 0, + }, + "Foo3": Object { + "$ref": 1, }, }, "variableScope": Object { @@ -813,7 +1121,7 @@ Object { }, "variables": Array [ Object { - "$id": 7, + "$id": 0, "defs": Array [ Object { "name": Object { @@ -831,7 +1139,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -849,40 +1157,11 @@ Object { "name": "Foo2", "references": Array [], "scope": Object { - "$ref": 8, + "$ref": 11, }, }, - ], - }, - Object { - "$id": 10, - "block": Object { - "range": Array [ - 84, - 116, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "Foo3": Object { - "$ref": 9, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ Object { - "$id": 9, + "$id": 1, "defs": Array [ Object { "name": Object { @@ -900,7 +1179,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -918,7 +1197,7 @@ Object { "name": "Foo3", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 11, }, }, ], @@ -926,59 +1205,7 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 69, - 72, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 103, - 106, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [ Object { "$ref": 2, @@ -992,105 +1219,17 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object { - "Foo2": Object { - "$ref": 0, - }, - "Foo3": Object { - "$ref": 1, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 11, + "$ref": 12, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 42, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - ], - "name": "Foo2", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 84, - 116, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - ], - "name": "Foo3", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -1098,160 +1237,26 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 11, - 19, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 11, - 17, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 26, - 34, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 26, - 32, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 54, - 56, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, + "childScopes": Array [ Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", + "$id": 8, + "block": Object { "range": Array [ - 71, - 73, + 0, + 110, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, + "type": "Program", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object { - "s1": Object { - "$ref": 0, - }, - "s2": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "s1", "range": Array [ 6, @@ -1259,52 +1264,41 @@ Object { ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 6, - 19, - ], - "type": "VariableDeclarator", + "kind": "w", + "resolved": Object { + "$ref": 0, }, - "parent": Object { + "writeExpr": Object { "range": Array [ - 0, - 34, + 11, + 19, ], - "type": "VariableDeclaration", + "type": "CallExpression", }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - ], - "name": "s1", - "references": Array [ Object { - "$ref": 2, - }, - Object { - "$ref": 6, + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "s2", "range": Array [ 21, @@ -1312,54 +1306,231 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { "range": Array [ - 21, + 26, 34, ], - "type": "VariableDeclarator", + "type": "CallExpression", }, - "parent": Object { + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", "range": Array [ - 0, - 34, + 26, + 32, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 54, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 71, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, }, ], - "name": "s2", - "references": Array [ + "throughReferences": Array [ Object { - "$ref": 4, + "$ref": 3, }, Object { - "$ref": 7, + "$ref": 5, }, ], - "scope": Object { + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { "$ref": 8, }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, }, ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -1367,160 +1538,26 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 11, - 19, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 11, - 17, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 26, - 34, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 26, - 32, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 51, - 53, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", + "$id": 8, + "block": Object { "range": Array [ - 68, - 70, + 0, + 107, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, + "type": "Program", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object { - "s1": Object { - "$ref": 0, - }, - "s2": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "s1", "range": Array [ 6, @@ -1528,52 +1565,41 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { "range": Array [ - 6, + 11, 19, ], - "type": "VariableDeclarator", + "type": "CallExpression", }, - "parent": Object { + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", "range": Array [ - 0, - 34, + 11, + 17, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - ], - "name": "s1", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 6, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "s2", "range": Array [ 21, @@ -1581,152 +1607,235 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { "range": Array [ - 21, + 26, 34, ], - "type": "VariableDeclarator", + "type": "CallExpression", }, - "parent": Object { + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", "range": Array [ - 0, - 34, + 26, + 32, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - ], - "name": "s2", - "references": Array [ + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 51, + 53, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, Object { - "$ref": 4, + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, }, + ], + "throughReferences": Array [ Object { - "$ref": 7, + "$ref": 3, + }, + Object { + "$ref": 5, }, ], - "scope": Object { + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { "$ref": 8, }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-function.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, - "references": Array [ + "references": Array [], + "throughReferences": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "f", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, + "$ref": 3, + }, + Object { + "$ref": 5, }, ], - "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 9, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 37, - ], - "type": "TSDeclareFunction", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [ - Object { - "$ref": 1, - }, - ], - "scope": Object { - "$ref": 2, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-function.ts 1`] = ` Object { "$id": 3, "block": Object { "range": Array [ 0, - 55, + 40, ], "type": "Program", }, @@ -1736,7 +1845,7 @@ Object { "block": Object { "range": Array [ 0, - 55, + 40, ], "type": "Program", }, @@ -1750,14 +1859,133 @@ Object { "$ref": 2, }, "identifier": Object { - "name": "C", + "name": "f", "range": Array [ 38, 39, ], "type": "Identifier", }, - "kind": "w", + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 37, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "w", "resolved": Object { "$ref": 0, }, @@ -1855,7 +2083,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-module.ts 1`] = ` Object { "$id": 8, "block": Object { @@ -2157,9 +2385,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/decorators.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/decorators.ts 1`] = ` Object { - "$id": 18, + "$id": 19, "block": Object { "range": Array [ 0, @@ -2169,106 +2397,23 @@ Object { }, "childScopes": Array [ Object { - "$id": 6, + "$id": 18, "block": Object { "range": Array [ 0, - 29, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 4, - }, - "target": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 6, - }, - "variables": Array [ - Object { - "$id": 4, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "target", - "range": Array [ - 13, - 24, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 29, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "target", - "range": Array [ - 13, - 24, - ], - "type": "Identifier", - }, - ], - "name": "target", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - Object { - "$id": 11, - "block": Object { - "range": Array [ - 30, - 100, + 198, ], - "type": "FunctionDeclaration", + "type": "Program", }, "childScopes": Array [ Object { - "$id": 10, + "$id": 6, "block": Object { "range": Array [ - 58, - 98, + 0, + 29, ], - "type": "ArrowFunctionExpression", + "type": "FunctionDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, @@ -2277,38 +2422,49 @@ Object { "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 11, + "$ref": 18, }, "variableMap": Object { - "propertyKey": Object { - "$ref": 9, + "arguments": Object { + "$ref": 4, }, "target": Object { - "$ref": 8, + "$ref": 5, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 6, }, "variables": Array [ Object { - "$id": 8, + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 5, "defs": Array [ Object { "name": Object { "name": "target", "range": Array [ - 59, - 70, + 13, + 24, ], "type": "Identifier", }, "node": Object { "range": Array [ - 58, - 98, + 0, + 29, ], - "type": "ArrowFunctionExpression", + "type": "FunctionDeclaration", }, "parent": null, "type": "Parameter", @@ -2319,8 +2475,8 @@ Object { Object { "name": "target", "range": Array [ - 59, - 70, + 13, + 24, ], "type": "Identifier", }, @@ -2328,418 +2484,515 @@ Object { "name": "target", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 6, }, }, + ], + }, + Object { + "$id": 11, + "block": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [ Object { - "$id": 9, - "defs": Array [ + "$id": 10, + "block": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "propertyKey": Object { + "$ref": 9, + }, + "target": Object { + "$ref": 8, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ Object { - "name": Object { - "name": "propertyKey", - "range": Array [ - 72, - 91, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 58, - 98, - ], - "type": "ArrowFunctionExpression", + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 10, }, - "parent": null, - "type": "Parameter", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "propertyKey", - "range": Array [ - 72, - 91, + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + ], + "name": "propertyKey", + "references": Array [], + "scope": Object { + "$ref": 10, + }, }, ], - "name": "propertyKey", - "references": Array [], - "scope": Object { - "$ref": 10, - }, }, ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 7, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 7, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - ], - }, - Object { - "$id": 17, - "block": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 16, - "block": Object { - "range": Array [ - 159, - 195, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, "references": Array [], "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 17, + "$ref": 18, }, "variableMap": Object { "arguments": Object { - "$ref": 15, + "$ref": 7, }, }, "variableScope": Object { - "$ref": 16, + "$ref": 11, }, "variables": Array [ Object { - "$id": 15, + "$id": 7, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], "scope": Object { - "$ref": 16, + "$ref": 11, }, }, ], }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 13, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "gec", - "range": Array [ - 122, - 125, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, Object { - "$id": 14, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "gec", + "$id": 17, + "block": Object { "range": Array [ - 147, - 150, + 102, + 197, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, + "type": "ClassDeclaration", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 13, - }, - Object { - "$ref": 14, - }, - ], - "type": "class", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "C": Object { - "$ref": 12, - }, - }, - "variableScope": Object { - "$ref": 18, - }, - "variables": Array [ - Object { - "$id": 12, - "defs": Array [ + "childScopes": Array [ Object { - "name": Object { - "name": "C", + "$id": 16, + "block": Object { "range": Array [ - 113, - 114, + 159, + 195, ], - "type": "Identifier", + "type": "FunctionExpression", }, - "node": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 17, }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 113, - 114, + "variableMap": Object { + "arguments": Object { + "$ref": 15, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ + Object { + "$id": 15, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, + }, + }, ], - "type": "Identifier", }, ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 17, + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 147, + 150, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 18, }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 3, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "dec", - "range": Array [ - 103, - 106, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "C": Object { - "$ref": 2, - }, - "dec": Object { - "$ref": 0, - }, - "gec": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 18, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "dec", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", + "variableMap": Object { + "C": Object { + "$ref": 12, + }, }, - "node": Object { - "range": Array [ - 0, - 29, - ], - "type": "FunctionDeclaration", + "variableScope": Object { + "$ref": 18, }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "dec", - "range": Array [ - 9, - 12, + "variables": Array [ + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, ], - "type": "Identifier", }, ], - "name": "dec", + "functionExpressionScope": false, + "isStrict": true, "references": Array [ Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 18, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "gec", + "$id": 3, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "dec", "range": Array [ - 39, - 42, + 103, + 106, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 30, - 100, - ], - "type": "FunctionDeclaration", + "kind": "r", + "resolved": Object { + "$ref": 0, }, - "parent": null, - "type": "FunctionName", + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "gec", - "range": Array [ - 39, - 42, - ], - "type": "Identifier", + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, }, - ], - "name": "gec", - "references": Array [ - Object { - "$ref": 13, + "dec": Object { + "$ref": 0, }, - Object { - "$ref": 14, + "gec": Object { + "$ref": 1, }, - ], - "scope": Object { + }, + "variableScope": Object { "$ref": 18, }, - }, - Object { - "$id": 2, - "defs": Array [ + "variables": Array [ Object { - "name": Object { - "name": "C", - "range": Array [ - 113, - 114, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "dec", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 18, }, - "parent": null, - "type": "ClassName", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "C", - "range": Array [ - 113, - 114, + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + ], + "name": "gec", + "references": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 18, + }, }, ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 18, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/enum.ts 1`] = ` Object { - "$id": 14, + "$id": 15, "block": Object { "range": Array [ 0, @@ -2749,203 +3002,34 @@ Object { }, "childScopes": Array [ Object { - "$id": 13, + "$id": 14, "block": Object { "range": Array [ - 20, - 70, + 0, + 71, ], - "type": "TSEnumDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "A", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "B", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": Object { - "range": Array [ - 48, - 53, - ], - "type": "BinaryExpression", - }, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 48, - 49, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, + "childScopes": Array [ Object { - "$id": 10, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "C", + "$id": 13, + "block": Object { "range": Array [ - 59, - 60, + 20, + 70, ], - "type": "Identifier", + "type": "TSEnumDeclaration", }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { - "range": Array [ - 63, - 68, - ], - "type": "BinaryExpression", - }, - }, - Object { - "$id": 11, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "A", - "range": Array [ - 63, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "B", - "range": Array [ - 67, - 68, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - ], - "type": "enum", - "upperScope": Object { - "$ref": 14, - }, - "variableMap": Object { - "A": Object { - "$ref": 3, - }, - "B": Object { - "$ref": 4, - }, - "C": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 3, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 6, + "from": Object { + "$ref": 13, + }, + "identifier": Object { "name": "A", "range": Array [ 33, @@ -2953,46 +3037,44 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "name": "a", "range": Array [ - 33, + 37, 38, ], - "type": "TSEnumMember", + "type": "Identifier", }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [ - Object { - "$ref": 6, }, Object { - "$ref": 11, + "$id": 7, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 13, - }, - }, - Object { - "$id": 4, - "defs": Array [ Object { - "name": Object { + "$id": 8, + "from": Object { + "$ref": 13, + }, + "identifier": Object { "name": "B", "range": Array [ 44, @@ -3000,46 +3082,43 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { "range": Array [ - 44, + 48, 53, ], - "type": "TSEnumMember", + "type": "BinaryExpression", }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "B", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - ], - "name": "B", - "references": Array [ - Object { - "$ref": 8, }, Object { - "$ref": 12, + "$id": 9, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 13, - }, - }, - Object { - "$id": 5, - "defs": Array [ Object { - "name": Object { + "$id": 10, + "from": Object { + "$ref": 13, + }, + "identifier": Object { "name": "C", "range": Array [ 59, @@ -3047,90 +3126,234 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { "range": Array [ - 59, + 63, 68, ], - "type": "TSEnumMember", + "type": "BinaryExpression", }, - "parent": undefined, - "type": "EnumMemberName", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "C", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", + "$id": 11, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, }, ], - "name": "C", - "references": Array [ + "throughReferences": Array [ Object { - "$ref": 10, + "$ref": 7, + }, + Object { + "$ref": 9, }, ], - "scope": Object { - "$ref": 13, + "type": "enum", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "A": Object { + "$ref": 3, + }, + "B": Object { + "$ref": 4, + }, + "C": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 33, + 38, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 53, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + ], + "name": "B", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 59, + 68, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + ], }, ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 18, - 19, - ], - "type": "Literal", - }, - }, - ], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "E": Object { - "$ref": 1, - }, - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 2, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "a", "range": Array [ 6, @@ -3138,97 +3361,152 @@ Object { ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 6, - 19, - ], - "type": "VariableDeclarator", + "kind": "w", + "resolved": Object { + "$ref": 0, }, - "parent": Object { + "writeExpr": Object { "range": Array [ - 0, + 18, 19, ], - "type": "VariableDeclaration", + "type": "Literal", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", }, ], - "name": "a", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 7, + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 15, + }, + "variableMap": Object { + "E": Object { + "$ref": 1, }, - Object { - "$ref": 9, + "a": Object { + "$ref": 0, }, - ], - "scope": Object { + }, + "variableScope": Object { "$ref": 14, }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "E", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 20, - 70, - ], - "type": "TSEnumDeclaration", - }, - "parent": undefined, - "type": "EnumName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + "variables": Array [ Object { - "name": "E", - "range": Array [ - 25, - 26, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "E", + "references": Array [], + "scope": Object { + "$ref": 14, + }, }, ], - "name": "E", - "references": Array [], - "scope": Object { - "$ref": 14, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/enum-string.ts 1`] = ` Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, @@ -3238,52 +3516,126 @@ Object { }, "childScopes": Array [ Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, - 28, + 29, ], - "type": "TSEnumDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 2, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "BAR", + "$id": 3, + "block": Object { "range": Array [ - 15, - 18, + 0, + 28, ], - "type": "Identifier", + "type": "TSEnumDeclaration", }, - "kind": "w", - "resolved": Object { - "$ref": 1, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 4, }, - "writeExpr": Object { - "range": Array [ - 21, - 26, - ], - "type": "Literal", + "variableMap": Object { + "BAR": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 26, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "BAR", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], - "type": "enum", + "type": "module", "upperScope": Object { - "$ref": 4, + "$ref": 5, }, "variableMap": Object { - "BAR": Object { - "$ref": 1, + "Foo": Object { + "$ref": 0, }, }, "variableScope": Object { @@ -3291,47 +3643,43 @@ Object { }, "variables": Array [ Object { - "$id": 1, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "BAR", + "name": "Foo", "range": Array [ - 15, - 18, + 5, + 8, ], "type": "Identifier", }, "node": Object { "range": Array [ - 15, - 26, + 0, + 28, ], - "type": "TSEnumMember", + "type": "TSEnumDeclaration", }, "parent": undefined, - "type": "EnumMemberName", + "type": "EnumName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "BAR", + "name": "Foo", "range": Array [ - 15, - 18, + 5, + 8, ], "type": "Identifier", }, ], - "name": "BAR", - "references": Array [ - Object { - "$ref": 2, - }, - ], + "name": "Foo", + "references": Array [], "scope": Object { - "$ref": 3, + "$ref": 4, }, }, ], @@ -3343,62 +3691,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 5, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 28, - ], - "type": "TSEnumDeclaration", - }, - "parent": undefined, - "type": "EnumName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, @@ -3406,28 +3709,57 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 0, - "from": Object { - "$ref": 1, - }, - "identifier": Object { - "name": "a", + "$id": 1, + "block": Object { "range": Array [ - 20, - 21, + 0, + 23, ], - "type": "Identifier", + "type": "Program", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], "throughReferences": Array [ Object { "$ref": 0, @@ -3437,15 +3769,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/expression-as.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, @@ -3453,28 +3785,57 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 0, - "from": Object { - "$ref": 1, - }, - "identifier": Object { - "name": "a", + "$id": 1, + "block": Object { "range": Array [ - 1, - 2, + 0, + 27, ], - "type": "Identifier", + "type": "Program", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], "throughReferences": Array [ Object { "$ref": 0, @@ -3484,15 +3845,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` Object { - "$id": 14, + "$id": 15, "block": Object { "range": Array [ 0, @@ -3500,570 +3861,232 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "foo", - "range": Array [ - 28, - 31, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 40, - 41, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, + "childScopes": Array [ Object { - "$id": 9, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "c", + "$id": 14, + "block": Object { "range": Array [ - 43, - 44, + 0, + 67, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 14, + "type": "Program", }, - "identifier": Object { - "name": "baz", - "range": Array [ - 48, - 51, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 11, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "d", - "range": Array [ - 57, - 58, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "e", - "range": Array [ - 60, - 61, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": undefined, - }, - Object { - "$id": 13, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "f", - "range": Array [ - 63, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 10, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - "b": Object { - "$ref": 1, - }, - "c": Object { - "$ref": 2, - }, - "d": Object { - "$ref": 3, - }, - "e": Object { - "$ref": 4, - }, - "f": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { - "name": "a", + "$id": 6, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "foo", "range": Array [ - 6, - 7, + 28, + 31, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 6, - 7, - ], - "type": "VariableDeclarator", + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 14, }, - "parent": Object { + "identifier": Object { + "name": "a", "range": Array [ - 0, - 22, + 37, + 38, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 7, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { + "$id": 8, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "b", "range": Array [ - 9, - 10, + 40, + 41, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 9, - 10, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "kind": "r", + "resolved": Object { + "$ref": 1, }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "b", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "b", - "references": Array [ - Object { - "$ref": 8, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 2, - "defs": Array [ Object { - "name": Object { + "$id": 9, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "c", "range": Array [ - 12, - 13, + 43, + 44, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 12, - 13, - ], - "type": "VariableDeclarator", + "kind": "r", + "resolved": Object { + "$ref": 2, }, - "parent": Object { + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "baz", "range": Array [ - 0, - 22, + 48, + 51, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "c", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - ], - "name": "c", - "references": Array [ - Object { - "$ref": 9, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 3, - "defs": Array [ Object { - "name": Object { + "$id": 11, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "d", "range": Array [ - 15, - 16, + 57, + 58, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 15, - 16, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "kind": "r", + "resolved": Object { + "$ref": 3, }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "d", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - ], - "name": "d", - "references": Array [ - Object { - "$ref": 11, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 4, - "defs": Array [ Object { - "name": Object { + "$id": 12, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "e", "range": Array [ - 18, - 19, + 60, + 61, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 18, - 19, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "kind": "r", + "resolved": Object { + "$ref": 4, }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "e", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - ], - "name": "e", - "references": Array [ - Object { - "$ref": 12, + "writeExpr": undefined, }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 5, - "defs": Array [ Object { - "name": Object { + "$id": 13, + "from": Object { + "$ref": 14, + }, + "identifier": Object { "name": "f", "range": Array [ - 21, - 22, + 63, + 64, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 21, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "kind": "r", + "resolved": Object { + "$ref": 5, }, - "type": "Variable", + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ + "throughReferences": Array [ Object { - "name": "f", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", + "$ref": 6, }, - ], - "name": "f", - "references": Array [ Object { - "$ref": 13, + "$ref": 10, }, ], - "scope": Object { - "$ref": 14, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` -Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 101, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 4, + "$ref": 15, }, "variableMap": Object { "a": Object { - "$ref": 2, + "$ref": 0, }, - "arguments": Object { + "b": Object { "$ref": 1, }, + "c": Object { + "$ref": 2, + }, + "d": Object { + "$ref": 3, + }, + "e": Object { + "$ref": 4, + }, + "f": Object { + "$ref": 5, + }, }, "variableScope": Object { - "$ref": 3, + "$ref": 14, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - Object { - "$id": 2, + "$id": 0, "defs": Array [ Object { "name": Object { "name": "a", "range": Array [ - 58, - 68, + 6, + 7, ], "type": "Identifier", }, "node": Object { "range": Array [ - 47, - 100, + 6, + 7, ], - "type": "FunctionDeclaration", + "type": "VariableDeclarator", }, - "parent": null, - "type": "Parameter", + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", }, ], "eslintUsed": undefined, @@ -4071,237 +4094,657 @@ Object { Object { "name": "a", "range": Array [ - 58, - 68, + 6, + 7, ], "type": "Identifier", }, ], "name": "a", - "references": Array [], + "references": Array [ + Object { + "$ref": 7, + }, + ], "scope": Object { - "$ref": 3, + "$ref": 14, }, }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ Object { - "name": Object { - "name": "f", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionDeclaration", + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 14, }, - "parent": null, - "type": "FunctionName", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "f", - "range": Array [ - 56, - 57, + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 18, - ], - "type": "TSDeclareFunction", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "name": "c", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, }, - "parent": null, - "type": "FunctionName", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "f", - "range": Array [ - 9, - 10, + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 16, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "d", + "references": Array [ + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 14, + }, }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 1, - }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 18, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, }, ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/function-overload.ts 1`] = ` Object { - "$id": 8, + "$id": 5, "block": Object { "range": Array [ 0, - 65, + 101, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 7, + "$id": 4, "block": Object { "range": Array [ 0, - 65, + 101, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 6, + "$id": 3, "block": Object { "range": Array [ - 7, - 64, + 47, + 100, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ Object { - "$id": 5, - "block": Object { - "range": Array [ - 35, - 62, - ], - "type": "FunctionExpression", + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + }, + Object { + "$id": 2, + "defs": Array [ Object { - "$id": 4, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "Decorator", + "name": Object { + "name": "a", "range": Array [ - 37, - 46, + 58, + 68, ], "type": "Identifier", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", }, ], - "throughReferences": Array [ + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$ref": 4, + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", }, ], - "type": "function", - "upperScope": Object { - "$ref": 6, + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 3, }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - "config": Object { - "$ref": 3, - }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", }, - "variableScope": Object { - "$ref": 5, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], @@ -4498,9 +4941,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, @@ -4508,73 +4951,98 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 110, - 114, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 110, - 114, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 106, - 114, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "a", - "range": Array [ - 110, - 114, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 110, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/import-equals.ts 1`] = ` Object { "$id": 2, "block": Object { @@ -4669,9 +5137,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/interface-type.ts 1`] = ` Object { - "$id": 0, + "$id": 1, "block": Object { "range": Array [ 0, @@ -4679,7 +5147,32 @@ Object { ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -4688,15 +5181,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 1, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/method-overload.ts 1`] = ` Object { - "$id": 10, + "$id": 11, "block": Object { "range": Array [ 0, @@ -4706,94 +5199,188 @@ Object { }, "childScopes": Array [ Object { - "$id": 9, + "$id": 10, "block": Object { "range": Array [ - 19, - 123, + 0, + 124, ], - "type": "ClassDeclaration", + "type": "Program", }, "childScopes": Array [ Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ - 73, - 121, + 19, + 123, ], - "type": "FunctionExpression", + "type": "ClassDeclaration", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 7, + }, + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + ], + "type": "class", "upperScope": Object { - "$ref": 9, + "$ref": 10, }, "variableMap": Object { - "a": Object { - "$ref": 7, - }, - "arguments": Object { - "$ref": 6, + "A": Object { + "$ref": 4, }, }, "variableScope": Object { - "$ref": 8, + "$ref": 10, }, "variables": Array [ Object { - "$id": 6, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 7, + "$id": 4, "defs": Array [ Object { "name": Object { - "name": "a", + "name": "A", "range": Array [ - 74, - 81, + 25, + 26, ], "type": "Identifier", }, "node": Object { "range": Array [ - 73, - 121, + 19, + 123, ], - "type": "FunctionExpression", + "type": "ClassDeclaration", }, - "parent": null, - "type": "Parameter", + "parent": undefined, + "type": "ClassName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "a", + "name": "A", "range": Array [ - 74, - 81, + 25, + 26, ], "type": "Identifier", }, ], - "name": "a", + "name": "A", "references": Array [], "scope": Object { - "$ref": 8, + "$ref": 9, }, }, ], @@ -4803,37 +5390,63 @@ Object { "isStrict": true, "references": Array [ Object { - "$id": 5, + "$id": 2, "from": Object { - "$ref": 9, + "$ref": 10, }, "identifier": Object { "name": "s", "range": Array [ - 59, - 60, + 6, + 7, ], "type": "Identifier", }, - "kind": "r", + "kind": "w", "resolved": Object { "$ref": 0, }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, "writeExpr": undefined, }, ], "throughReferences": Array [ Object { - "$ref": 5, + "$ref": 3, }, ], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 10, + "$ref": 11, }, "variableMap": Object { "A": Object { - "$ref": 4, + "$ref": 1, + }, + "s": Object { + "$ref": 0, }, }, "variableScope": Object { @@ -4841,7 +5454,60 @@ Object { }, "variables": Array [ Object { - "$id": 4, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, "defs": Array [ Object { "name": Object { @@ -4859,7 +5525,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -4877,7 +5543,7 @@ Object { "name": "A", "references": Array [], "scope": Object { - "$ref": 9, + "$ref": 10, }, }, ], @@ -4885,50 +5551,7 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 18, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 10, - 16, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [ Object { "$ref": 3, @@ -4936,142 +5559,41 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object { - "A": Object { - "$ref": 1, - }, - "s": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 10, + "$ref": 11, }, - "variables": Array [ + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/namespace.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 18, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "s", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 10, + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", }, - }, - Object { - "$id": 1, - "defs": Array [ + "childScopes": Array [ Object { - "name": Object { - "name": "A", + "$id": 8, + "block": Object { "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 123, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 10, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/namespace.ts 1`] = ` -Object { - "$id": 10, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 24, - 56, + 24, + 56, ], "type": "TSModuleBlock", }, @@ -5392,9 +5914,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/rest-element.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/rest-element.ts 1`] = ` Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, @@ -5404,55 +5926,125 @@ Object { }, "childScopes": Array [ Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, - 34, + 35, ], - "type": "FunctionDeclaration", + "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "args": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + ], + "name": "args", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], "functionExpressionScope": false, - "isStrict": false, + "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 4, + "$ref": 5, }, "variableMap": Object { - "args": Object { - "$ref": 2, - }, - "arguments": Object { - "$ref": 1, + "foo": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 3, + "$ref": 4, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - Object { - "$id": 2, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "args", + "name": "foo", "range": Array [ - 16, - 20, + 9, + 12, ], "type": "Identifier", }, @@ -5464,24 +6056,24 @@ Object { "type": "FunctionDeclaration", }, "parent": null, - "type": "Parameter", + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "args", + "name": "foo", "range": Array [ - 16, - 20, + 9, + 12, ], "type": "Identifier", }, ], - "name": "args", + "name": "foo", "references": Array [], "scope": Object { - "$ref": 3, + "$ref": 4, }, }, ], @@ -5493,62 +6085,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 5, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 34, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-alias.ts 1`] = ` Object { - "$id": 0, + "$id": 1, "block": Object { "range": Array [ 0, @@ -5556,24 +6103,49 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], -} + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` Object { - "$id": 7, + "$id": 8, "block": Object { "range": Array [ 0, @@ -5583,94 +6155,164 @@ Object { }, "childScopes": Array [ Object { - "$id": 6, + "$id": 7, "block": Object { "range": Array [ - 32, - 102, + 0, + 103, ], - "type": "ClassDeclaration", + "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 6, "block": Object { "range": Array [ - 47, - 100, + 32, + 102, ], - "type": "FunctionExpression", + "type": "ClassDeclaration", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "class", "upperScope": Object { - "$ref": 6, + "$ref": 7, }, "variableMap": Object { - "a": Object { - "$ref": 4, - }, - "arguments": Object { - "$ref": 3, + "C": Object { + "$ref": 2, }, }, "variableScope": Object { - "$ref": 5, + "$ref": 7, }, "variables": Array [ Object { - "$id": 3, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - Object { - "$id": 4, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "a", + "name": "C", "range": Array [ - 48, - 59, + 38, + 39, ], "type": "Identifier", }, "node": Object { "range": Array [ - 47, - 100, + 32, + 102, ], - "type": "FunctionExpression", + "type": "ClassDeclaration", }, - "parent": null, - "type": "Parameter", + "parent": undefined, + "type": "ClassName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "a", + "name": "C", "range": Array [ - 48, - 59, + 38, + 39, ], "type": "Identifier", }, ], - "name": "a", + "name": "C", "references": Array [], "scope": Object { - "$ref": 5, + "$ref": 6, }, }, ], @@ -5680,13 +6322,16 @@ Object { "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 7, + "$ref": 8, }, "variableMap": Object { "C": Object { - "$ref": 2, + "$ref": 1, + }, + "a": Object { + "$ref": 0, }, }, "variableScope": Object { @@ -5694,7 +6339,53 @@ Object { }, "variables": Array [ Object { - "$id": 2, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + Object { + "$id": 1, "defs": Array [ Object { "name": Object { @@ -5712,7 +6403,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -5730,7 +6421,7 @@ Object { "name": "C", "references": Array [], "scope": Object { - "$ref": 6, + "$ref": 7, }, }, ], @@ -5742,203 +6433,147 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "C": Object { - "$ref": 1, - }, - "a": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 7, + "$ref": 8, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 20, - 31, - ], - "type": "Identifier", + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 4, }, - "node": Object { + "identifier": Object { + "name": "a", "range": Array [ - 20, - 31, + 17, + 18, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - "parent": Object { + "kind": "w", + "resolved": null, + "writeExpr": Object { "range": Array [ - 16, - 31, + 21, + 26, ], - "type": "VariableDeclaration", + "type": "TSTypeAssertion", }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "a", - "range": Array [ - 20, - 31, - ], - "type": "Identifier", + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { - "name": "C", + "$id": 2, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", "range": Array [ - 38, - 39, + 28, + 29, ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": null, + "writeExpr": Object { "range": Array [ 32, - 102, + 38, ], - "type": "ClassDeclaration", + "type": "TSAsExpression", }, - "parent": null, - "type": "ClassName", + }, + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ + "throughReferences": Array [ Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, }, ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` -Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 0, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 21, - 26, - ], - "type": "TSTypeAssertion", - }, - }, - Object { - "$id": 1, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 32, - 38, - ], - "type": "TSAsExpression", + "type": "module", + "upperScope": Object { + "$ref": 5, }, - }, - Object { - "$id": 3, - "from": Object { + "variableMap": Object {}, + "variableScope": Object { "$ref": 4, }, - "identifier": Object { - "name": "b", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "variables": Array [], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], "throughReferences": Array [ Object { "$ref": 0, @@ -5957,15 +6592,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 5, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, @@ -5975,41 +6610,111 @@ Object { }, "childScopes": Array [ Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, - 18, + 19, ], - "type": "FunctionDeclaration", + "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], "functionExpressionScope": false, - "isStrict": false, + "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 4, }, "variableMap": Object { - "arguments": Object { - "$ref": 1, + "f": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 2, + "$ref": 3, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 3, }, }, ], @@ -6021,62 +6726,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 4, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 18, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof.ts 1`] = ` Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, @@ -6084,72 +6744,26 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, + "childScopes": Array [ Object { - "$id": 2, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "obj", + "$id": 3, + "block": Object { "range": Array [ - 39, - 42, + 0, + 43, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "type": "Program", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 1, + "from": Object { + "$ref": 3, + }, + "identifier": Object { "name": "obj", "range": Array [ 4, @@ -6157,54 +6771,125 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { "range": Array [ - 4, + 10, 22, ], - "type": "VariableDeclarator", + "type": "ObjectExpression", }, - "parent": Object { + }, + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", "range": Array [ - 0, - 22, + 39, + 42, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], "name": "obj", - "range": Array [ - 4, - 7, + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 2, + "scope": Object { + "$ref": 3, + }, }, ], - "scope": Object { - "$ref": 3, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -6212,184 +6897,26 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 27, - 40, - ], - "type": "TSTypeAssertion", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 39, - 40, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 46, - 61, - ], - "type": "TSAsExpression", - }, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 46, - 47, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, + "childScopes": Array [ Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", + "$id": 8, + "block": Object { "range": Array [ - 58, - 61, + 0, + 63, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "type": "Program", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "obj", "range": Array [ 4, @@ -6397,57 +6924,253 @@ Object { ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { "range": Array [ - 4, + 10, 22, ], - "type": "VariableDeclarator", + "type": "ObjectExpression", }, - "parent": Object { + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", "range": Array [ - 0, - 22, + 23, + 24, ], - "type": "VariableDeclaration", + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 27, + 40, + ], + "type": "TSTypeAssertion", }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 46, + 61, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, }, ], - "name": "obj", - "references": Array [ + "throughReferences": Array [ Object { - "$ref": 1, + "$ref": 2, }, Object { - "$ref": 3, + "$ref": 4, }, Object { - "$ref": 7, + "$ref": 5, + }, + Object { + "$ref": 6, }, ], - "scope": Object { + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { "$ref": 8, }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, }, ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -6455,167 +7178,26 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 24, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 61, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 76, - 79, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 95, - 98, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 125, - 128, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 140, - 143, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", + "$id": 8, + "block": Object { "range": Array [ - 159, - 162, + 0, + 165, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "type": "Program", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { "name": "obj", "range": Array [ 6, @@ -6623,180 +7205,213 @@ Object { ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 6, - 24, - ], - "type": "VariableDeclarator", + "kind": "w", + "resolved": Object { + "$ref": 0, }, - "parent": Object { + "writeExpr": Object { "range": Array [ - 0, + 12, 24, ], - "type": "VariableDeclaration", + "type": "ObjectExpression", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 1, }, Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 83, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 3, + "$id": 2, "from": Object { - "$ref": 4, + "$ref": 8, }, "identifier": Object { - "name": "a", + "name": "obj", "range": Array [ - 30, - 31, + 61, + 64, ], "type": "Identifier", }, "kind": "r", "resolved": Object { - "$ref": 2, + "$ref": 0, }, "writeExpr": undefined, }, - ], + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 125, + 128, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 140, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 159, + 162, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 5, + "$ref": 9, }, "variableMap": Object { - "a": Object { - "$ref": 2, - }, - "arguments": Object { - "$ref": 1, + "obj": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 4, + "$ref": 8, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "a", + "name": "obj", "range": Array [ - 11, - 20, + 6, + 9, ], "type": "Identifier", }, "node": Object { + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + "parent": Object { "range": Array [ 0, - 82, + 24, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, - "parent": null, - "type": "Parameter", + "type": "Variable", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "a", + "name": "obj", "range": Array [ - 11, - 20, + 6, + 9, ], "type": "Identifier", }, ], - "name": "a", + "name": "obj", "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, Object { "$ref": 3, }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, ], "scope": Object { - "$ref": 4, + "$ref": 8, }, }, ], @@ -6808,149 +7423,198 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 5, + "$ref": 9, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` Object { - "$id": 5, + "$id": 6, "block": Object { "range": Array [ 0, - 62, + 83, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, - 61, + 83, ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - "g": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 4, + "type": "Program", }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, + "$id": 4, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ Object { - "$id": 3, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "g", + "name": "f", "range": Array [ - 31, - 35, + 9, + 10, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 61, + 82, ], "type": "FunctionDeclaration", }, "parent": null, - "type": "Parameter", + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "g", + "name": "f", "range": Array [ - 31, - 35, + 9, + 10, ], "type": "Identifier", }, ], - "name": "g", + "name": "f", "references": Array [], "scope": Object { - "$ref": 4, + "$ref": 5, }, }, ], @@ -6958,504 +7622,20772 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "g", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "g": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 5, + "$ref": 6, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "g", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 61, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "g", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "g", - "references": Array [ - Object { - "$ref": 1, - }, - ], - "scope": Object { - "$ref": 5, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` Object { - "$id": 11, + "$id": 6, "block": Object { "range": Array [ 0, - 147, + 62, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ - Object { - "$id": 4, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, + "childScopes": Array [ Object { "$id": 5, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { + "block": Object { "range": Array [ - 46, - 58, + 0, + 62, ], - "type": "ObjectExpression", + "type": "Program", }, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 40, - 43, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "value", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "g": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "g", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, }, - "kind": "w", - "resolved": Object { - "$ref": 2, + "variableMap": Object { + "g": Object { + "$ref": 0, + }, }, - "writeExpr": Object { - "range": Array [ - 87, - 99, - ], - "type": "ObjectExpression", + "variableScope": Object { + "$ref": 5, }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 8, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", + "$id": 11, + "block": Object { "range": Array [ - 81, - 84, + 0, + 147, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "type": "Program", }, - "writeExpr": undefined, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 46, + 58, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 87, + 99, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 132, + 146, + ], + "type": "ArrayExpression", + }, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 12, + }, + "variableMap": Object { + "element": Object { + "$ref": 3, + }, + "obj": Object { + "$ref": 0, + }, + "obj2": Object { + "$ref": 1, + }, + "value": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 23, + 58, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + ], + "name": "obj2", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 63, + 99, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 59, + 99, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + ], + "name": "value", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 104, + 146, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 100, + 146, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + ], + "name": "element", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-infer.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "intersection": Object { + "$ref": 1, + }, + "precedence1": Object { + "$ref": 2, + }, + "precedence2": Object { + "$ref": 3, + }, + "union": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + ], + "name": "union", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + ], + "name": "intersection", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + ], + "name": "precedence1", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + ], + "name": "precedence2", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/535.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 52, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 69, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 8, + "block": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo3": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo2": Object { + "$ref": 0, + }, + "Foo3": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 54, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 71, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 51, + 53, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-function.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 37, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 42, + 43, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 25, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": true, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 33, + 92, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 89, + 90, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "b": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 52, + 61, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 46, + 61, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 79, + 90, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 90, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 93, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 7, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/decorators.ts 1`] = ` +Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + "target": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 11, + "block": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "propertyKey": Object { + "$ref": 9, + }, + "target": Object { + "$ref": 8, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + ], + "name": "propertyKey", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + Object { + "$id": 17, + "block": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 16, + "block": Object { + "range": Array [ + 159, + 195, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 17, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 15, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ + Object { + "$id": 15, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 147, + 150, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "C": Object { + "$ref": 12, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "dec", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + "dec": Object { + "$ref": 0, + }, + "gec": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "dec", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + ], + "name": "gec", + "references": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/enum.ts 1`] = ` +Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 13, + "block": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 48, + 53, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 63, + 68, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "type": "enum", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "A": Object { + "$ref": 3, + }, + "B": Object { + "$ref": 4, + }, + "C": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 33, + 38, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 53, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + ], + "name": "B", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 59, + 68, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 18, + 19, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "E": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "E", + "references": Array [], + "scope": Object { + "$ref": 14, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "BAR": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 26, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "BAR", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "c", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "d", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 60, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + "b": Object { + "$ref": 1, + }, + "c": Object { + "$ref": 2, + }, + "d": Object { + "$ref": 3, + }, + "e": Object { + "$ref": 4, + }, + "f": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 7, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "name": "c", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 16, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "d", + "references": Array [ + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 18, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/function-overload.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + ], + "name": "config", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "Test": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Test": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 110, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 27, + ], + "type": "TSImportEqualsDeclaration", + }, + "parent": null, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 7, + }, + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/namespace.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 24, + 56, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 47, + 48, + ], + "type": "Literal", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 43, + 48, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 37, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "N", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "N": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 56, + ], + "type": "TSModuleDeclaration", + }, + "parent": null, + "type": "NamespaceName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + ], + "name": "N", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/rest-element.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 35, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "args": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + ], + "name": "args", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 32, + 38, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 27, + 40, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 46, + 61, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 24, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 125, + 128, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 140, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 159, + 162, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "g": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "g", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "g": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 46, + 58, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 87, + 99, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 132, + 146, + ], + "type": "ArrayExpression", + }, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "element": Object { + "$ref": 3, + }, + "obj": Object { + "$ref": 0, + }, + "obj2": Object { + "$ref": 1, + }, + "value": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 23, + 58, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + ], + "name": "obj2", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 63, + 99, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 59, + 99, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + ], + "name": "value", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 104, + 146, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 100, + 146, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + ], + "name": "element", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-infer.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "intersection": Object { + "$ref": 1, + }, + "precedence1": Object { + "$ref": 2, + }, + "precedence2": Object { + "$ref": 3, + }, + "union": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + ], + "name": "union", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + ], + "name": "intersection", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + ], + "name": "precedence1", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + ], + "name": "precedence2", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/535.ts 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 52, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 52, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 69, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 69, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 8, + "block": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo3": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 12, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 0, + }, + "Foo3": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 54, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 71, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 51, + 53, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-function.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 37, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 42, + 43, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 25, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": true, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 33, + 92, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 89, + 90, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "b": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 52, + 61, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 46, + 61, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 79, + 90, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 90, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 93, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/decorators.ts 1`] = ` +Object { + "$id": 19, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + "target": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 11, + "block": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "propertyKey": Object { + "$ref": 9, + }, + "target": Object { + "$ref": 8, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + ], + "name": "propertyKey", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + Object { + "$id": 17, + "block": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 16, + "block": Object { + "range": Array [ + 159, + 195, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 17, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 15, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ + Object { + "$id": 15, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 147, + 150, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "C": Object { + "$ref": 12, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "dec", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + "dec": Object { + "$ref": 0, + }, + "gec": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "dec", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + ], + "name": "gec", + "references": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum.ts 1`] = ` +Object { + "$id": 15, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 13, + "block": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 48, + 53, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 63, + 68, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "type": "enum", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "A": Object { + "$ref": 3, + }, + "B": Object { + "$ref": 4, + }, + "C": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 33, + 38, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 53, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + ], + "name": "B", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 59, + 68, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 18, + 19, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 15, + }, + "variableMap": Object { + "E": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "E", + "references": Array [], + "scope": Object { + "$ref": 14, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "BAR": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 26, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "BAR", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +Object { + "$id": 15, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "c", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "d", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 60, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 15, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + "b": Object { + "$ref": 1, + }, + "c": Object { + "$ref": 2, + }, + "d": Object { + "$ref": 3, + }, + "e": Object { + "$ref": 4, + }, + "f": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 7, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "name": "c", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 16, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "d", + "references": Array [ + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 18, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + ], + "name": "config", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "Test": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "Test": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 110, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 27, + ], + "type": "TSImportEqualsDeclaration", + }, + "parent": null, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 7, + }, + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/namespace.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 24, + 56, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 47, + 48, + ], + "type": "Literal", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 43, + 48, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 37, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "N", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "N": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 56, + ], + "type": "TSModuleDeclaration", + }, + "parent": null, + "type": "NamespaceName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + ], + "name": "N", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/rest-element.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 35, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 35, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "args": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + ], + "name": "args", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "C": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 32, + 38, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 27, + 40, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 46, + 61, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 24, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 125, + 128, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 140, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 159, + 162, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "g": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "g", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "g": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 46, + 58, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 87, + 99, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 132, + 146, + ], + "type": "ArrayExpression", + }, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 12, + }, + "variableMap": Object { + "element": Object { + "$ref": 3, + }, + "obj": Object { + "$ref": 0, + }, + "obj2": Object { + "$ref": 1, + }, + "value": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 23, + 58, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + ], + "name": "obj2", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 63, + 99, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 59, + 99, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + ], + "name": "value", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 104, + 146, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 100, + 146, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + ], + "name": "element", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 9, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { + "$id": 0, + "block": Object { "range": Array [ - 132, - 146, + 0, + 20, ], - "type": "ArrayExpression", - }, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 11, + "type": "Program", }, - "identifier": Object { - "name": "obj", - "range": Array [ - 123, - 126, - ], - "type": "Identifier", + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, }, - "kind": "r", - "resolved": Object { + "variableMap": Object {}, + "variableScope": Object { "$ref": 0, }, - "writeExpr": undefined, + "variables": Array [], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "element": Object { - "$ref": 3, - }, - "obj": Object { - "$ref": 0, - }, - "obj2": Object { - "$ref": 1, - }, - "value": Object { - "$ref": 2, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 11, + "$ref": 1, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - ], - "scope": Object { - "$ref": 11, - }, - }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [ Object { "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 27, - 58, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 23, - 58, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "name": "obj2", - "references": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "$ref": 5, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "scope": Object { - "$ref": 11, - }, }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "value", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 63, - 99, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 59, - 99, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "value", - "range": Array [ - 65, - 70, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", - }, - ], - "name": "value", - "references": Array [ - Object { - "$ref": 7, + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "scope": Object { - "$ref": 11, - }, }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 104, - 146, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 100, - 146, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "name": "element", - "references": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "$ref": 9, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "scope": Object { - "$ref": 11, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-infer.ts 1`] = ` Object { - "$id": 0, + "$id": 1, "block": Object { "range": Array [ 0, - 20, + 147, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -7464,91 +28396,166 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 1, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` Object { "$id": 1, "block": Object { "range": Array [ 0, - 49, + 50, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { "$ref": 1, }, - "variables": Array [ + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 47, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, + ], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, @@ -7556,159 +28563,184 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 45, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 46, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 45, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 13, + 48, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 11, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 12, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 11, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-infer.ts 1`] = ` -Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 147, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -7717,23 +28749,99 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` Object { - "$id": 0, + "$id": 2, "block": Object { "range": Array [ 0, - 50, + 49, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -7742,327 +28850,300 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` Object { "$id": 1, "block": Object { "range": Array [ 0, - 37, + 81, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 35, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 35, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 36, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 35, - ], - "type": "Identifier", - }, - ], - "name": "map", + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, "references": Array [], - "scope": Object { + "throughReferences": Array [], + "type": "module", + "upperScope": Object { "$ref": 1, }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 45, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 46, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` Object { "$id": 1, "block": Object { "range": Array [ 0, - 48, + 29, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { "$ref": 1, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 46, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 46, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 47, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 46, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 49, + 10, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 2, }, - "variables": Array [ + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "map", - "range": Array [ - 4, - 47, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` -Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 81, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -8071,15 +29152,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` Object { - "$id": 0, + "$id": 2, "block": Object { "range": Array [ 0, @@ -8087,7 +29168,83 @@ Object { ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -8096,555 +29253,703 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 2, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 10, + 33, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 8, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 9, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 8, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 22, + 11, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 20, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 20, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 21, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 20, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 29, + 45, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 27, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 27, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 28, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 27, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, ], - "type": "Identifier", + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 33, + 29, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 31, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 31, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 32, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 31, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` Object { "$id": 1, "block": Object { "range": Array [ 0, - 11, + 29, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { "$ref": 1, }, - "variables": Array [ + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 9, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 10, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ Object { - "name": "x", - "range": Array [ - 4, - 9, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 45, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 2, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 44, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` Object { - "$id": 1, + "$id": 3, "block": Object { "range": Array [ 0, - 29, + 38, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 28, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 28, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 28, - ], - "type": "VariableDeclaration", + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "x", - "range": Array [ - 4, - 28, + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` -Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -8653,245 +29958,124 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 3, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` Object { - "$id": 1, + "$id": 3, "block": Object { "range": Array [ 0, - 24, + 19, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 22, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 23, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 22, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [], - "scope": Object { - "$ref": 1, + "$id": 2, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 38, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - "y": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", + "$id": 1, + "from": Object { + "$ref": 2, }, - "node": Object { + "identifier": Object { + "name": "y", "range": Array [ - 4, 14, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, 15, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ + "throughReferences": Array [ Object { - "name": "x", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", + "$ref": 1, }, ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, + "type": "module", + "upperScope": Object { + "$ref": 3, }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "y", - "range": Array [ - 20, - 36, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 20, - 36, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 16, - 37, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "variableMap": Object { + "x": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ Object { - "name": "y", - "range": Array [ - 20, - 36, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, }, ], - "name": "y", - "references": Array [], - "scope": Object { - "$ref": 2, - }, }, ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 19, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "y", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [ Object { "$ref": 1, @@ -8899,68 +30083,17 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 3, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 17, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 17, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 17, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], + "variables": Array [], } `; exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, @@ -8968,222 +30101,247 @@ Object { ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "intersection": Object { - "$ref": 1, - }, - "precedence1": Object { - "$ref": 2, - }, - "precedence2": Object { - "$ref": 3, - }, - "union": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "union", - "range": Array [ - 4, - 36, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 36, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 37, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$id": 4, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "intersection": Object { + "$ref": 1, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "union", - "range": Array [ - 4, - 36, - ], - "type": "Identifier", + "precedence1": Object { + "$ref": 2, }, - ], - "name": "union", - "references": Array [], - "scope": Object { + "precedence2": Object { + "$ref": 3, + }, + "union": Object { + "$ref": 0, + }, + }, + "variableScope": Object { "$ref": 4, }, - }, - Object { - "$id": 1, - "defs": Array [ + "variables": Array [ Object { - "name": Object { - "name": "intersection", - "range": Array [ - 42, - 71, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 42, - 71, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 38, - 72, - ], - "type": "VariableDeclaration", + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + ], + "name": "union", + "references": Array [], + "scope": Object { + "$ref": 4, }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "intersection", - "range": Array [ - 42, - 71, + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", - }, - ], - "name": "intersection", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "precedence1", - "range": Array [ - 77, - 115, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 77, - 115, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 73, - 116, - ], - "type": "VariableDeclaration", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + ], + "name": "intersection", + "references": Array [], + "scope": Object { + "$ref": 4, }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "precedence1", - "range": Array [ - 77, - 115, + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", - }, - ], - "name": "precedence1", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "precedence2", - "range": Array [ - 121, - 159, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 121, - 159, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 117, - 160, - ], - "type": "VariableDeclaration", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + ], + "name": "precedence1", + "references": Array [], + "scope": Object { + "$ref": 4, }, - "type": "Variable", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "precedence2", - "range": Array [ - 121, - 159, + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + ], + "name": "precedence2", + "references": Array [], + "scope": Object { + "$ref": 4, + }, }, ], - "name": "precedence2", - "references": Array [], - "scope": Object { - "$ref": 4, - }, }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], } `; exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` Object { - "$id": 0, + "$id": 1, "block": Object { "range": Array [ 0, @@ -9191,7 +30349,32 @@ Object { ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], "functionExpressionScope": false, "isStrict": false, "references": Array [], @@ -9200,7 +30383,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 1, }, "variables": Array [], } diff --git a/tests/lib/__snapshots__/tsx.js.snap b/tests/lib/__snapshots__/tsx.js.snap index 2c696e0..34119d8 100644 --- a/tests/lib/__snapshots__/tsx.js.snap +++ b/tests/lib/__snapshots__/tsx.js.snap @@ -200,7 +200,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/__snapshots__/typescript.js.snap b/tests/lib/__snapshots__/typescript.js.snap index dcb703d..320bf39 100644 --- a/tests/lib/__snapshots__/typescript.js.snap +++ b/tests/lib/__snapshots__/typescript.js.snap @@ -130,7 +130,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -463,7 +463,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1768,7 +1768,7 @@ Object { 0, 63, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2141,7 +2141,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3398,7 +3398,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3804,7 +3804,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4326,7 +4326,7 @@ Object { 0, 97, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5338,7 +5338,7 @@ Object { 0, 174, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6230,7 +6230,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6622,7 +6622,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6990,7 +6990,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7339,7 +7339,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7830,7 +7830,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8331,7 +8331,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8795,7 +8795,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9164,7 +9164,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9406,7 +9406,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9721,7 +9721,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10089,7 +10089,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11173,7 +11173,7 @@ Object { 0, 207, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12464,7 +12464,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13016,7 +13016,7 @@ Object { 0, 68, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13715,7 +13715,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14177,7 +14177,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14871,7 +14871,7 @@ Object { 0, 203, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15997,7 +15997,7 @@ Object { 0, 211, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17123,7 +17123,7 @@ Object { 0, 199, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18071,7 +18071,7 @@ Object { 0, 109, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18570,7 +18570,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18980,7 +18980,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19348,7 +19348,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19643,7 +19643,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19939,7 +19939,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20218,7 +20218,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20576,7 +20576,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20945,7 +20945,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21333,7 +21333,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21819,7 +21819,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24878,7 +24878,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25437,7 +25437,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26174,7 +26174,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26812,7 +26812,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27274,7 +27274,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27750,7 +27750,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28316,7 +28316,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28985,7 +28985,7 @@ Object { 0, 97, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29767,7 +29767,7 @@ Object { 0, 56, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30386,7 +30386,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30790,7 +30790,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31049,7 +31049,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31326,7 +31326,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -32764,7 +32764,7 @@ Object { 0, 297, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34951,7 +34951,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35409,7 +35409,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35758,7 +35758,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36042,7 +36042,7 @@ Object { 0, 88, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36521,7 +36521,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37105,7 +37105,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37327,7 +37327,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37713,7 +37713,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38242,7 +38242,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38902,7 +38902,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39522,7 +39522,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40146,7 +40146,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40983,7 +40983,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41493,7 +41493,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41985,7 +41985,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42441,7 +42441,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42953,7 +42953,7 @@ Object { 0, 75, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -43776,7 +43776,7 @@ Object { 0, 138, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44523,7 +44523,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45119,7 +45119,7 @@ Object { 0, 90, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45629,7 +45629,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46036,7 +46036,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46564,7 +46564,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46968,7 +46968,7 @@ Object { 0, 55, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47336,7 +47336,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47731,7 +47731,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48454,7 +48454,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49171,7 +49171,7 @@ Object { 0, 55, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49799,7 +49799,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50276,7 +50276,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50597,7 +50597,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51083,7 +51083,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51569,7 +51569,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52035,7 +52035,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52429,7 +52429,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53092,7 +53092,7 @@ Object { 0, 116, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53829,7 +53829,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54422,7 +54422,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55105,7 +55105,7 @@ Object { 0, 98, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55842,7 +55842,7 @@ Object { 0, 111, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56540,7 +56540,7 @@ Object { 0, 88, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57225,7 +57225,7 @@ Object { 0, 93, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57816,7 +57816,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58263,7 +58263,7 @@ Object { 0, 54, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58595,7 +58595,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58802,7 +58802,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59026,7 +59026,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59251,7 +59251,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59493,7 +59493,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59789,7 +59789,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60394,7 +60394,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62465,7 +62465,7 @@ Object { 0, 596, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65459,7 +65459,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65882,7 +65882,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66254,7 +66254,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66517,7 +66517,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66977,7 +66977,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -67676,7 +67676,7 @@ Object { 0, 114, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68826,7 +68826,7 @@ Object { 0, 231, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69645,7 +69645,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/tests/lib/comments.js b/tests/lib/comments.js index 008924e..e6714f1 100644 --- a/tests/lib/comments.js +++ b/tests/lib/comments.js @@ -35,7 +35,8 @@ describe("Comments", () => { testFiles.forEach(filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); const config = { - jsx: true + jsx: true, + sourceType: "module" }; test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/tests/lib/scope-analysis.js b/tests/lib/scope-analysis.js index 1455502..eb60890 100644 --- a/tests/lib/scope-analysis.js +++ b/tests/lib/scope-analysis.js @@ -142,34 +142,69 @@ describe("TypeScript scope analysis", () => { const root = "tests/fixtures/scope-analysis"; const files = fs.readdirSync(root).map(filename => path.join(root, filename).replace(/\\/g, "/")); - for (const filePath of files) { - test(filePath, () => { - const code = fs.readFileSync(filePath, "utf8"); - const { scopeManager } = parser.parseForESLint(code, { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {} - }); - const { globalScope } = scopeManager; - - // Do the postprocess to test. - // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 - globalScope.through = globalScope.through.filter(reference => { - const name = reference.identifier.name; - const variable = globalScope.set.get(name); - if (variable) { - reference.resolved = variable; - variable.references.push(reference); - return false; - } - return true; + describe("sourceType: module", () => { + for (const filePath of files) { + test(filePath, () => { + const code = fs.readFileSync(filePath, "utf8"); + const { scopeManager } = parser.parseForESLint(code, { + loc: true, + range: true, + tokens: true, + sourceType: "module", + ecmaFeatures: {} + }); + const { globalScope } = scopeManager; + + // Do the postprocess to test. + // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + if (variable) { + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + + const scopeTree = scopeToJSON(globalScope); + expect(scopeTree).toMatchSnapshot(); }); + } + }); - const scopeTree = scopeToJSON(globalScope); - expect(scopeTree).toMatchSnapshot(); - }); - } + describe("sourceType: script", () => { + for (const filePath of files) { + test(filePath, () => { + const code = fs.readFileSync(filePath, "utf8"); + const { scopeManager } = parser.parseForESLint(code, { + loc: true, + range: true, + tokens: true, + sourceType: "script", + ecmaFeatures: {} + }); + const { globalScope } = scopeManager; + + // Do the postprocess to test. + // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + if (variable) { + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + + const scopeTree = scopeToJSON(globalScope); + expect(scopeTree).toMatchSnapshot(); + }); + } + }); const linter = new Linter(); linter.defineParser("typescript-eslint-parser", parser); @@ -312,7 +347,7 @@ export default class Test { expect(messages).toStrictEqual([]); }); - test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + test("1: https://github.com/eslint/typescript-eslint-parser/issues/535", () => { const code = ` function foo({ bar }: { bar: string }) { console.log(bar); @@ -330,7 +365,7 @@ function foo({ bar }: { bar: string }) { expect(messages).toStrictEqual([]); }); - test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + test("2: https://github.com/eslint/typescript-eslint-parser/issues/535", () => { const code = ` import { observable, @@ -345,6 +380,9 @@ export default class ListModalStore { parser: "typescript-eslint-parser", rules: { "no-unused-vars": "error" + }, + parserOptions: { + sourceType: "module" } }; const messages = linter.verify(code, config, { filename: "issue.ts" }); diff --git a/tools/test-utils.js b/tools/test-utils.js index f8dfdc5..f9d2e94 100644 --- a/tools/test-utils.js +++ b/tools/test-utils.js @@ -48,7 +48,8 @@ function createSnapshotTestBlock(code, config = {}) { raw: true, tokens: true, comment: true, - errorOnUnknownASTType: true + errorOnUnknownASTType: true, + sourceType: "module" }; config = Object.assign({}, defaultConfig, config); From f464a2d15cc32ebac5114de7a28cb8c04114f893 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 13 Jan 2019 03:44:06 +0100 Subject: [PATCH 6/6] test: cleanup old snapshots --- .../lib/__snapshots__/scope-analysis.js.snap | 10658 ---------------- 1 file changed, 10658 deletions(-) diff --git a/tests/lib/__snapshots__/scope-analysis.js.snap b/tests/lib/__snapshots__/scope-analysis.js.snap index b7298d5..a6b210a 100644 --- a/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/tests/lib/__snapshots__/scope-analysis.js.snap @@ -19730,10661 +19730,3 @@ Object { "variables": Array [], } `; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/535.ts 1`] = ` -Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 52, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 52, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 3, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "bar", - "range": Array [ - 45, - 48, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - "bar": Object { - "$ref": 2, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "bar", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "bar", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - ], - "name": "bar", - "references": Array [ - Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 6, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 69, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 69, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 68, - ], - "type": "TSAbstractClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "A": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 68, - ], - "type": "TSAbstractClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-implements.ts 1`] = ` -Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 83, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 83, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` -Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 7, - "block": Object { - "range": Array [ - 19, - 62, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 5, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 50, - 51, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "type": "class", - "upperScope": Object { - "$ref": 8, - }, - "variableMap": Object { - "A": Object { - "$ref": 4, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 62, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 18, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 10, - 16, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "A": Object { - "$ref": 1, - }, - "s": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 18, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "s", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 62, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` -Object { - "$id": 12, - "block": Object { - "range": Array [ - 0, - 117, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 11, - "block": Object { - "range": Array [ - 0, - 117, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "TSAbstractClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 40, - ], - "type": "TSAbstractClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - Object { - "$id": 8, - "block": Object { - "range": Array [ - 42, - 82, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "Foo2": Object { - "$ref": 7, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 7, - "defs": Array [ - Object { - "name": Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 42, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - ], - "name": "Foo2", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - Object { - "$id": 10, - "block": Object { - "range": Array [ - 84, - 116, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "Foo3": Object { - "$ref": 9, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 9, - "defs": Array [ - Object { - "name": Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 84, - 116, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - ], - "name": "Foo3", - "references": Array [], - "scope": Object { - "$ref": 10, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 69, - 72, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "Bar", - "range": Array [ - 103, - 106, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - Object { - "$ref": 4, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 12, - }, - "variableMap": Object { - "Foo2": Object { - "$ref": 0, - }, - "Foo3": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 42, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo2", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - ], - "name": "Foo2", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 84, - 116, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo3", - "range": Array [ - 90, - 94, - ], - "type": "Identifier", - }, - ], - "name": "Foo3", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - Object { - "$ref": 4, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 12, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` -Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 110, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 110, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 11, - 19, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 11, - 17, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 26, - 34, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 26, - 32, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 54, - 56, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 71, - 73, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "s1": Object { - "$ref": 0, - }, - "s2": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 19, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 34, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - ], - "name": "s1", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 6, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 34, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 34, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - ], - "name": "s2", - "references": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` -Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 107, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 107, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 11, - 19, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 11, - 17, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 26, - 34, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 26, - 32, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s1", - "range": Array [ - 51, - 53, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s2", - "range": Array [ - 68, - 70, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "s1": Object { - "$ref": 0, - }, - "s2": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 19, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 34, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - ], - "name": "s1", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 6, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 34, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 34, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s2", - "range": Array [ - 21, - 23, - ], - "type": "Identifier", - }, - ], - "name": "s2", - "references": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - Object { - "$ref": 5, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-function.ts 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "f", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 37, - ], - "type": "TSDeclareFunction", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [ - Object { - "$ref": 1, - }, - ], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-global.ts 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 55, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 55, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 42, - 43, - ], - "type": "Literal", - }, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object { - "C": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 25, - 34, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 25, - 34, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 21, - 34, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": true, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 25, - 34, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [ - Object { - "$ref": 1, - }, - ], - "scope": Object { - "$ref": 3, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-module.ts 1`] = ` -Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 95, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 7, - "block": Object { - "range": Array [ - 0, - 95, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 33, - 92, - ], - "type": "TSModuleBlock", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 5, - "from": Object { - "$ref": 6, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 89, - 90, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "block", - "upperScope": Object { - "$ref": 7, - }, - "variableMap": Object { - "a": Object { - "$ref": 3, - }, - "b": Object { - "$ref": 4, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 52, - 61, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 52, - 61, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 46, - 61, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 52, - 61, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 6, - }, - }, - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "b", - "range": Array [ - 79, - 90, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 79, - 90, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 73, - 90, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "b", - "range": Array [ - 79, - 90, - ], - "type": "Identifier", - }, - ], - "name": "b", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 11, - ], - "type": "Literal", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 93, - 94, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 8, - }, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 11, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 11, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, - ], - "scope": Object { - "$ref": 7, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/decorators.ts 1`] = ` -Object { - "$id": 19, - "block": Object { - "range": Array [ - 0, - 198, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 18, - "block": Object { - "range": Array [ - 0, - 198, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 4, - }, - "target": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 6, - }, - "variables": Array [ - Object { - "$id": 4, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "target", - "range": Array [ - 13, - 24, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 29, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "target", - "range": Array [ - 13, - 24, - ], - "type": "Identifier", - }, - ], - "name": "target", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - Object { - "$id": 11, - "block": Object { - "range": Array [ - 30, - 100, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 10, - "block": Object { - "range": Array [ - 58, - 98, - ], - "type": "ArrowFunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "propertyKey": Object { - "$ref": 9, - }, - "target": Object { - "$ref": 8, - }, - }, - "variableScope": Object { - "$ref": 10, - }, - "variables": Array [ - Object { - "$id": 8, - "defs": Array [ - Object { - "name": Object { - "name": "target", - "range": Array [ - 59, - 70, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 58, - 98, - ], - "type": "ArrowFunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "target", - "range": Array [ - 59, - 70, - ], - "type": "Identifier", - }, - ], - "name": "target", - "references": Array [], - "scope": Object { - "$ref": 10, - }, - }, - Object { - "$id": 9, - "defs": Array [ - Object { - "name": Object { - "name": "propertyKey", - "range": Array [ - 72, - 91, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 58, - 98, - ], - "type": "ArrowFunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "propertyKey", - "range": Array [ - 72, - 91, - ], - "type": "Identifier", - }, - ], - "name": "propertyKey", - "references": Array [], - "scope": Object { - "$ref": 10, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 7, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 7, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 11, - }, - }, - ], - }, - Object { - "$id": 17, - "block": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 16, - "block": Object { - "range": Array [ - 159, - 195, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 17, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 15, - }, - }, - "variableScope": Object { - "$ref": 16, - }, - "variables": Array [ - Object { - "$id": 15, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 16, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 13, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "gec", - "range": Array [ - 122, - 125, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - Object { - "$id": 14, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "gec", - "range": Array [ - 147, - 150, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 13, - }, - Object { - "$ref": 14, - }, - ], - "type": "class", - "upperScope": Object { - "$ref": 18, - }, - "variableMap": Object { - "C": Object { - "$ref": 12, - }, - }, - "variableScope": Object { - "$ref": 18, - }, - "variables": Array [ - Object { - "$id": 12, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 113, - 114, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 113, - 114, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 17, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 3, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "dec", - "range": Array [ - 103, - 106, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 19, - }, - "variableMap": Object { - "C": Object { - "$ref": 2, - }, - "dec": Object { - "$ref": 0, - }, - "gec": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 18, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "dec", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 29, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "dec", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "dec", - "references": Array [ - Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 18, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "gec", - "range": Array [ - 39, - 42, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 30, - 100, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "gec", - "range": Array [ - 39, - 42, - ], - "type": "Identifier", - }, - ], - "name": "gec", - "references": Array [ - Object { - "$ref": 13, - }, - Object { - "$ref": 14, - }, - ], - "scope": Object { - "$ref": 18, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 113, - 114, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 102, - 197, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 113, - 114, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 18, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 19, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum.ts 1`] = ` -Object { - "$id": 15, - "block": Object { - "range": Array [ - 0, - 71, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 14, - "block": Object { - "range": Array [ - 0, - 71, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 13, - "block": Object { - "range": Array [ - 20, - 70, - ], - "type": "TSEnumDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "A", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "B", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": Object { - "range": Array [ - 48, - 53, - ], - "type": "BinaryExpression", - }, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 48, - 49, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "C", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { - "range": Array [ - 63, - 68, - ], - "type": "BinaryExpression", - }, - }, - Object { - "$id": 11, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "A", - "range": Array [ - 63, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 13, - }, - "identifier": Object { - "name": "B", - "range": Array [ - 67, - 68, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - ], - "type": "enum", - "upperScope": Object { - "$ref": 14, - }, - "variableMap": Object { - "A": Object { - "$ref": 3, - }, - "B": Object { - "$ref": 4, - }, - "C": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 33, - 38, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 11, - }, - ], - "scope": Object { - "$ref": 13, - }, - }, - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "B", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 44, - 53, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "B", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - ], - "name": "B", - "references": Array [ - Object { - "$ref": 8, - }, - Object { - "$ref": 12, - }, - ], - "scope": Object { - "$ref": 13, - }, - }, - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 59, - 68, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [ - Object { - "$ref": 10, - }, - ], - "scope": Object { - "$ref": 13, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 18, - 19, - ], - "type": "Literal", - }, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 15, - }, - "variableMap": Object { - "E": Object { - "$ref": 1, - }, - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 19, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 19, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "E", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 20, - 70, - ], - "type": "TSEnumDeclaration", - }, - "parent": undefined, - "type": "EnumName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "E", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "E", - "references": Array [], - "scope": Object { - "$ref": 14, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 15, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum-string.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 28, - ], - "type": "TSEnumDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "BAR", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 21, - 26, - ], - "type": "Literal", - }, - }, - ], - "throughReferences": Array [], - "type": "enum", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "BAR": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "BAR", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 15, - 26, - ], - "type": "TSEnumMember", - }, - "parent": undefined, - "type": "EnumMemberName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "BAR", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - ], - "name": "BAR", - "references": Array [ - Object { - "$ref": 2, - }, - ], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 28, - ], - "type": "TSEnumDeclaration", - }, - "parent": undefined, - "type": "EnumName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 23, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 23, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 0, - "from": Object { - "$ref": 1, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-as.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 27, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 27, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 0, - "from": Object { - "$ref": 1, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` -Object { - "$id": 15, - "block": Object { - "range": Array [ - 0, - 67, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 14, - "block": Object { - "range": Array [ - 0, - 67, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "foo", - "range": Array [ - 28, - 31, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 40, - 41, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "c", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "baz", - "range": Array [ - 48, - 51, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 11, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "d", - "range": Array [ - 57, - 58, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "e", - "range": Array [ - 60, - 61, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": undefined, - }, - Object { - "$id": 13, - "from": Object { - "$ref": 14, - }, - "identifier": Object { - "name": "f", - "range": Array [ - 63, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 10, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 15, - }, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - "b": Object { - "$ref": 1, - }, - "c": Object { - "$ref": 2, - }, - "d": Object { - "$ref": 3, - }, - "e": Object { - "$ref": 4, - }, - "f": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 14, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 7, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "b", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 9, - 10, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "b", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "b", - "references": Array [ - Object { - "$ref": 8, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "c", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 12, - 13, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "c", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - ], - "name": "c", - "references": Array [ - Object { - "$ref": 9, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "d", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 15, - 16, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "d", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - ], - "name": "d", - "references": Array [ - Object { - "$ref": 11, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "e", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 18, - 19, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "e", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - ], - "name": "e", - "references": Array [ - Object { - "$ref": 12, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [ - Object { - "$ref": 13, - }, - ], - "scope": Object { - "$ref": 14, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 10, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 15, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 101, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 101, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "a": Object { - "$ref": 2, - }, - "arguments": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 58, - 68, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 58, - 68, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 18, - ], - "type": "TSDeclareFunction", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` -Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 65, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 7, - "block": Object { - "range": Array [ - 0, - 65, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 7, - 64, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 35, - 62, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 4, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "Decorator", - "range": Array [ - 37, - 46, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "function", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - "config": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "config", - "range": Array [ - 47, - 53, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 35, - 62, - ], - "type": "FunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "config", - "range": Array [ - 47, - 53, - ], - "type": "Identifier", - }, - ], - "name": "config", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "class", - "upperScope": Object { - "$ref": 7, - }, - "variableMap": Object { - "Test": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "Test", - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 7, - 64, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Test", - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - }, - ], - "name": "Test", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 8, - }, - "variableMap": Object { - "Test": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Test", - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 7, - 64, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Test", - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - }, - ], - "name": "Test", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 115, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 115, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 110, - 114, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 110, - 114, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 106, - 114, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 110, - 114, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/import-equals.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 28, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 28, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 27, - ], - "type": "TSImportEqualsDeclaration", - }, - "parent": null, - "type": "ImportBinding", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 67, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 67, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` -Object { - "$id": 11, - "block": Object { - "range": Array [ - 0, - 124, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 10, - "block": Object { - "range": Array [ - 0, - 124, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 9, - "block": Object { - "range": Array [ - 19, - 123, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 73, - 121, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "a": Object { - "$ref": 7, - }, - "arguments": Object { - "$ref": 6, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 6, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 7, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 74, - 81, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 73, - 121, - ], - "type": "FunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 74, - 81, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 5, - "from": Object { - "$ref": 9, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 5, - }, - ], - "type": "class", - "upperScope": Object { - "$ref": 10, - }, - "variableMap": Object { - "A": Object { - "$ref": 4, - }, - }, - "variableScope": Object { - "$ref": 10, - }, - "variables": Array [ - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 123, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 9, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 18, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 10, - 16, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "A": Object { - "$ref": 1, - }, - "s": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 10, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 18, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "s", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 10, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 19, - 123, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "A", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 10, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/namespace.ts 1`] = ` -Object { - "$id": 10, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 24, - 56, - ], - "type": "TSModuleBlock", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { - "range": Array [ - 47, - 48, - ], - "type": "Literal", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "block", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "a": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [ - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 43, - 48, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 37, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 9, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 11, - ], - "type": "Literal", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 9, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 57, - 58, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 9, - }, - "identifier": Object { - "name": "N", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 10, - }, - "variableMap": Object { - "N": Object { - "$ref": 1, - }, - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 11, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 11, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 9, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "N", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 12, - 56, - ], - "type": "TSModuleDeclaration", - }, - "parent": null, - "type": "NamespaceName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "N", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - ], - "name": "N", - "references": Array [ - Object { - "$ref": 4, - }, - ], - "scope": Object { - "$ref": 9, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 10, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/rest-element.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 35, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 35, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 34, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "args": Object { - "$ref": 2, - }, - "arguments": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "args", - "range": Array [ - 16, - 20, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 34, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "args", - "range": Array [ - 16, - 20, - ], - "type": "Identifier", - }, - ], - "name": "args", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 34, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-alias.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 18, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 18, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` -Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 103, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 7, - "block": Object { - "range": Array [ - 0, - 103, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 32, - 102, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "a": Object { - "$ref": 4, - }, - "arguments": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 3, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 48, - 59, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 48, - 59, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 7, - }, - "variableMap": Object { - "C": Object { - "$ref": 2, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 32, - 102, - ], - "type": "ClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 8, - }, - "variableMap": Object { - "C": Object { - "$ref": 1, - }, - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 20, - 31, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 20, - 31, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 16, - 31, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 20, - 31, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 32, - 102, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - ], - "name": "C", - "references": Array [], - "scope": Object { - "$ref": 7, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 40, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 0, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 21, - 26, - ], - "type": "TSTypeAssertion", - }, - }, - Object { - "$id": 1, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 32, - 38, - ], - "type": "TSAsExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 0, - }, - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` -Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 19, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 19, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 18, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 18, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` -Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 43, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 43, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 3, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 39, - 42, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, - ], - "scope": Object { - "$ref": 3, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` -Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 63, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 27, - 40, - ], - "type": "TSTypeAssertion", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 35, - 38, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 39, - 40, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": null, - "writeExpr": Object { - "range": Array [ - 46, - 61, - ], - "type": "TSAsExpression", - }, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "b", - "range": Array [ - 46, - 47, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 58, - 61, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 3, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 2, - }, - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` -Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 165, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 165, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 24, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 61, - 64, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 76, - 79, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 95, - 98, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 125, - 128, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 140, - 143, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 159, - 162, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 24, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 24, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` -Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 83, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 83, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 3, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "a": Object { - "$ref": 2, - }, - "arguments": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 11, - 20, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 11, - 20, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "f": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "f", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 6, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` -Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 62, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 62, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 61, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - "g": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "g", - "range": Array [ - 31, - 35, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 61, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "g", - "range": Array [ - 31, - 35, - ], - "type": "Identifier", - }, - ], - "name": "g", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "g", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "g": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "g", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 61, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "g", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - ], - "name": "g", - "references": Array [ - Object { - "$ref": 1, - }, - ], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 6, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` -Object { - "$id": 12, - "block": Object { - "range": Array [ - 0, - 147, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 11, - "block": Object { - "range": Array [ - 0, - 147, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 4, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 22, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 46, - 58, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 40, - 43, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "value", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": Object { - "range": Array [ - 87, - 99, - ], - "type": "ObjectExpression", - }, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 81, - 84, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "range": Array [ - 132, - 146, - ], - "type": "ArrayExpression", - }, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "obj", - "range": Array [ - 123, - 126, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 12, - }, - "variableMap": Object { - "element": Object { - "$ref": 3, - }, - "obj": Object { - "$ref": 0, - }, - "obj2": Object { - "$ref": 1, - }, - "value": Object { - "$ref": 2, - }, - }, - "variableScope": Object { - "$ref": 11, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - ], - "scope": Object { - "$ref": 11, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 27, - 58, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 23, - 58, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj2", - "range": Array [ - 27, - 43, - ], - "type": "Identifier", - }, - ], - "name": "obj2", - "references": Array [ - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 11, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "value", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 63, - 99, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 59, - 99, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "value", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - ], - "name": "value", - "references": Array [ - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 11, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 104, - 146, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 100, - 146, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "element", - "range": Array [ - 105, - 112, - ], - "type": "Identifier", - }, - ], - "name": "element", - "references": Array [ - Object { - "$ref": 9, - }, - ], - "scope": Object { - "$ref": 11, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 12, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 20, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 20, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 49, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 49, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 45, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 46, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 13, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 13, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 11, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 12, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 11, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-infer.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 147, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 147, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 50, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 50, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 37, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 37, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 35, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 35, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 36, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 35, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 47, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 45, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 46, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 45, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 48, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 48, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 46, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 46, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 47, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 46, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 49, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 49, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "map": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "map", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "map", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - }, - ], - "name": "map", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 81, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 81, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 10, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 10, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 8, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 8, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 9, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 8, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 22, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 22, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 20, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 20, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 21, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 20, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 27, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 27, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 28, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 27, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 33, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 33, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 31, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 31, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 32, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 31, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 11, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 11, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 9, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 10, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 9, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 45, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 45, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 44, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 28, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 28, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 28, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 28, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 29, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 24, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 24, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "obj": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "obj", - "range": Array [ - 4, - 22, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 23, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "obj", - "range": Array [ - 4, - 22, - ], - "type": "Identifier", - }, - ], - "name": "obj", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 38, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 38, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - "y": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 14, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 15, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 14, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "y", - "range": Array [ - 20, - 36, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 20, - 36, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 16, - 37, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "y", - "range": Array [ - 20, - 36, - ], - "type": "Identifier", - }, - ], - "name": "y", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 19, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 19, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "y", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "x", - "range": Array [ - 4, - 17, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 17, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 17, - ], - "type": "Identifier", - }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` -Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 161, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 4, - "block": Object { - "range": Array [ - 0, - 161, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "intersection": Object { - "$ref": 1, - }, - "precedence1": Object { - "$ref": 2, - }, - "precedence2": Object { - "$ref": 3, - }, - "union": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "union", - "range": Array [ - 4, - 36, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 4, - 36, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 37, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "union", - "range": Array [ - 4, - 36, - ], - "type": "Identifier", - }, - ], - "name": "union", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "intersection", - "range": Array [ - 42, - 71, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 42, - 71, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 38, - 72, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "intersection", - "range": Array [ - 42, - 71, - ], - "type": "Identifier", - }, - ], - "name": "intersection", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "precedence1", - "range": Array [ - 77, - 115, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 77, - 115, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 73, - 116, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "precedence1", - "range": Array [ - 77, - 115, - ], - "type": "Identifier", - }, - ], - "name": "precedence1", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "precedence2", - "range": Array [ - 121, - 159, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 121, - 159, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 117, - 160, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "precedence2", - "range": Array [ - 121, - 159, - ], - "type": "Identifier", - }, - ], - "name": "precedence2", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 27, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 27, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`;