Skip to content

Commit

Permalink
Instrument: Code comment [nocode]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Dec 21, 2023
1 parent 651fbc0 commit 56441f8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/instrument/visitors/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 56441f8

Please sign in to comment.