From 56441f861913d6bb2b2375520ece75e5b58c9ba5 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Thu, 21 Dec 2023 02:30:16 +0000 Subject: [PATCH] Instrument: Code comment [nocode] --- lib/instrument/visitors/function.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/instrument/visitors/function.js b/lib/instrument/visitors/function.js index fa48a0ab..8541e773 100644 --- a/lib/instrument/visitors/function.js +++ b/lib/instrument/visitors/function.js @@ -577,6 +577,9 @@ function hoistSloppyFunctionDeclaration(declaration) { // In CommonJS code, file block is CommonJS wrapper function's params, and in any other context // file block contains no bindings except `this`. So it's safe to treat as a params block in all cases. // NB: `paramsBlockBinding.argNames` check is to avoid the pseudo-param `arguments` blocking hoisting. + // An actual param called `arguments` *does* prevent hoisting. + // e.g. `function f(arguments) { { function arguments() {} } return arguments; }` + // returns the value outer function is called with, not the inner function. const paramsBlockBinding = hoistBlock.parent.bindings.get(varName); if (paramsBlockBinding && !paramsBlockBinding.argNames) return;