From 6fe1909e542e0b731bf57538ef12af31836eafdd Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 4 Aug 2015 13:03:49 +0100 Subject: [PATCH] simplify NodePath#inShadow --- packages/babel/src/traversal/path/ancestry.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/babel/src/traversal/path/ancestry.js b/packages/babel/src/traversal/path/ancestry.js index 66049e4856..734a3cf515 100644 --- a/packages/babel/src/traversal/path/ancestry.js +++ b/packages/babel/src/traversal/path/ancestry.js @@ -186,15 +186,17 @@ export function inShadow(key?) { do { if (path.isFunction()) { var shadow = path.node.shadow; - if (shadow || path.isArrowFunctionExpression()) { + if (shadow) { // this is because sometimes we may have a `shadow` value of: // // { this: false } // // we need to catch this case if `inShadow` has been passed a `key` - if (!key || !shadow || shadow[key] !== false) { + if (!key || shadow[key] !== false) { return path; } + } else if (path.isArrowFunctionExpression()) { + return path; } // normal function, we've found our function context