diff --git a/lib/instrument/visitors/function.js b/lib/instrument/visitors/function.js index 7186aedb..4d77e917 100644 --- a/lib/instrument/visitors/function.js +++ b/lib/instrument/visitors/function.js @@ -554,8 +554,7 @@ function hoistSloppyFunctionDeclaration(declaration) { // If any binding in intermediate blocks, do not hoist. // NB This includes function declarations which will be themselves hoisted. - const originBlock = declaration.block; - let thisBlock = originBlock.parent; + let thisBlock = declaration.block.parent; while (thisBlock !== hoistBlock) { if (thisBlock.bindings[varName]) return; thisBlock = thisBlock.parent;