diff options
Diffstat (limited to 'tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js')
-rw-r--r-- | tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js index 9d24068b98..b27f22678a 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/scope/index.js @@ -152,9 +152,7 @@ const collectorVisitor = { if (binding) binding.reference(path); } else if (t().isVariableDeclaration(declar)) { for (const decl of declar.declarations) { - const ids = t().getBindingIdentifiers(decl); - - for (const name in ids) { + for (const name of Object.keys(t().getBindingIdentifiers(decl))) { const binding = scope.getBinding(name); if (binding) binding.reference(path); } @@ -371,7 +369,7 @@ class Scope { do { console.log("#", scope.block.type); - for (const name in scope.bindings) { + for (const name of Object.keys(scope.bindings)) { const binding = scope.bindings[name]; console.log(" -", name, { constant: binding.constant, @@ -472,7 +470,7 @@ class Scope { registerConstantViolation(path) { const ids = path.getBindingIdentifiers(); - for (const name in ids) { + for (const name of Object.keys(ids)) { const binding = this.getBinding(name); if (binding) binding.reassign(path); } @@ -492,9 +490,9 @@ class Scope { } const parent = this.getProgramParent(); - const ids = path.getBindingIdentifiers(true); + const ids = path.getOuterBindingIdentifiers(true); - for (const name in ids) { + for (const name of Object.keys(ids)) { for (const id of ids[name]) { const local = this.getOwnBinding(name); @@ -687,7 +685,7 @@ class Scope { const ids = path.getBindingIdentifiers(); let programParent; - for (const name in ids) { + for (const name of Object.keys(ids)) { if (path.scope.getBinding(name)) continue; programParent = programParent || path.scope.getProgramParent(); programParent.addGlobal(ids[name]); @@ -800,7 +798,7 @@ class Scope { let scope = this; do { - for (const name in scope.bindings) { + for (const name of Object.keys(scope.bindings)) { const binding = scope.bindings[name]; if (binding.kind === kind) ids[name] = binding; } |