From 1922eda9d3cf1b948622e473930415033ae5b11b Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Wed, 10 Apr 2024 14:37:31 +0200 Subject: [PATCH] add vars to scope manager declaredVariables (#84) This makes eslint sourceCode getDeclaredVariables work which is required for some rules to work --- src/parser/transforms.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser/transforms.js b/src/parser/transforms.js index 8f72e13..e4fdeab 100644 --- a/src/parser/transforms.js +++ b/src/parser/transforms.js @@ -508,12 +508,17 @@ module.exports.convertAst = function convertAst(result, preprocessedResult, visi const scope = result.isTypescript ? new TypescriptScope.BlockScope(result.scopeManager, upperScope, node) : new Scope(result.scopeManager, 'block', upperScope, node); + const declaredVariables = + result.scopeManager.declaredVariables || result.scopeManager.__declaredVariables; + const vars = []; + declaredVariables.set(node, vars); for (const [i, b] of node.params.entries()) { const v = new Variable(b.name, scope); v.identifiers.push(b); v.defs.push(new Definition('Parameter', b, node, node, i, 'Block Param')); scope.variables.push(v); scope.set.set(b.name, v); + vars.push(v); } } return null;