From d41cb1154530cf410d5b392403cb62fcce7ce0d1 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 8 Jun 2015 01:46:05 +0100 Subject: [PATCH] fix registerDeclaration for FlowDeclarations --- src/babel/traversal/scope/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/babel/traversal/scope/index.js b/src/babel/traversal/scope/index.js index bbf90a1479..7d828b5d04 100644 --- a/src/babel/traversal/scope/index.js +++ b/src/babel/traversal/scope/index.js @@ -434,19 +434,18 @@ export default class Scope { */ registerDeclaration(path: NodePath) { - var node = path.node; - if (t.isFunctionDeclaration(node)) { + if (path.isFunctionDeclaration()) { this.registerBinding("hoisted", path); - } else if (t.isVariableDeclaration(node)) { + } else if (path.isVariableDeclaration()) { var declarations = path.get("declarations"); for (var declar of (declarations: Array)) { - this.registerBinding(node.kind, declar); + this.registerBinding(path.node.kind, declar); } - } else if (t.isClassDeclaration(node)) { + } else if (path.isClassDeclaration()) { this.registerBinding("let", path); - } else if (t.isImportDeclaration(node) || t.isExportDeclaration(node)) { + } else if (path.isImportDeclaration() || path.isExportDeclaration()) { this.registerBinding("module", path); - } else if (t.isFlowDeclaration()) { + } else if (path.isFlowDeclaration()) { this.registerBinding("type", path); } else { this.registerBinding("unknown", path);