Move up check for binding kind "local"

This puts the check before the call to `checkBlockScopedCollisions`.
Fixes #4946.
This commit is contained in:
Moti Zilberman 2017-03-19 11:05:55 +00:00 committed by Justin Ridgewell
parent 68786c4f0f
commit 48c114169f

View File

@ -519,6 +519,11 @@ export default class Scope {
for (const name in ids) {
for (const id of (ids[name]: Array<Object>)) {
let local = this.getOwnBinding(name);
// Ignore existing binding if it's the name of the current function or class
// expression
if (local && local.kind === "local") local = null;
if (local) {
// same identifier so continue safely as we're likely trying to register it
// multiple times
@ -532,8 +537,6 @@ export default class Scope {
// in `warnOnFlowBinding`.
if (local && local.path.isFlow()) local = null;
if (local && local.kind === "local") local = null;
parent.references[name] = true;
this.bindings[name] = new Binding({