From be55f42f80aee18ec28b71ddc9c72f71b918f07f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 31 Jan 2015 10:06:22 +1100 Subject: [PATCH] simplify Scope::has --- lib/6to5/traverse/scope.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/6to5/traverse/scope.js b/lib/6to5/traverse/scope.js index fe0097fc79..5143b9bfba 100644 --- a/lib/6to5/traverse/scope.js +++ b/lib/6to5/traverse/scope.js @@ -387,8 +387,11 @@ Scope.prototype.parentGet = function (id, decl) { */ Scope.prototype.has = function (id, decl) { - return (id && (this.hasOwn(id, decl) || this.parentHas(id, decl))) || - contains(Scope.defaultDeclarations, id); + if (!id) return false; + if (this.hasOwn(id, decl)) return true; + if (this.parentHas(id, decl)) return true; + if (contains(Scope.defaultDeclarations, id)) return true; + return false; }; /**