From 81b5827f55510bea6c65c1081fa20527c11b0423 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 19 Mar 2017 15:00:15 -0400 Subject: [PATCH] some annotateWithScopes fixes --- src/generators/annotateWithScopes.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/generators/annotateWithScopes.js b/src/generators/annotateWithScopes.js index 36894b5060..a598ef22d1 100644 --- a/src/generators/annotateWithScopes.js +++ b/src/generators/annotateWithScopes.js @@ -28,7 +28,7 @@ export default function annotateWithScopes ( expression ) { node._scope = scope = new Scope( scope, true ); } - else if ( /Declaration/.test( node.type ) ) { + else if ( /(Function|Class|Variable)Declaration/.test( node.type ) ) { scope.addDeclaration( node ); } }, @@ -54,7 +54,7 @@ class Scope { if ( node.kind === 'var' && !this.block && this.parent ) { this.parent.addDeclaration( node ); } else if ( node.type === 'VariableDeclaration' ) { - node.declarators.forEach( declarator => { + node.declarations.forEach( declarator => { extractNames( declarator.id ).forEach( name => { this.declarations[ name ] = true; }); @@ -100,4 +100,3 @@ const extractors = { extractors[ param.left.type ]( names, param.left ); } }; -