MCPcopy
hub / github.com/webpack/webpack / inFunctionScope

Method inFunctionScope

lib/javascript/JavascriptParser.js:4644–4666  ·  view source on GitHub ↗

* Processes the provided has thi. * @param {boolean} hasThis true, when this is defined * @param {(Pattern | string)[]} params scope params * @param {() => void} fn inner function * @returns {void}

(hasThis, params, fn)

Source from the content-addressed store, hash-verified

4642 * @returns {void}
4643 */
4644 inFunctionScope(hasThis, params, fn) {
4645 const oldScope = this.scope;
4646 this.scope = {
4647 topLevelScope: oldScope.topLevelScope,
4648 inTry: false,
4649 inShorthand: false,
4650 inTaggedTemplateTag: false,
4651 isStrict: oldScope.isStrict,
4652 isAsmJs: oldScope.isAsmJs,
4653 terminated: undefined,
4654 definitions: oldScope.definitions.createChild()
4655 };
4656
4657 if (hasThis) {
4658 this.undefineVariable("this");
4659 }
4660
4661 this.enterPatterns(params, this._defineVariable);
4662
4663 fn();
4664
4665 this.scope = oldScope;
4666 }
4667
4668 /**
4669 * Processes the provided fn.

Callers 9

_walkIIFEMethod · 0.95
processCallRequireMethod · 0.80
processCallDefineMethod · 0.80
applyMethod · 0.80

Calls 4

undefineVariableMethod · 0.95
enterPatternsMethod · 0.95
createChildMethod · 0.80
fnFunction · 0.50

Tested by

no test coverage detected