MCPcopy
hub / github.com/webpack/webpack / inBlockScope

Method inBlockScope

lib/javascript/JavascriptParser.js:4674–4696  ·  view source on GitHub ↗

* Processes the provided fn. * @param {() => void} fn inner function * @param {boolean} inExecutedPath executed state * @returns {void}

(fn, inExecutedPath = false)

Source from the content-addressed store, hash-verified

4672 * @returns {void}
4673 */
4674 inBlockScope(fn, inExecutedPath = false) {
4675 const oldScope = this.scope;
4676 this.scope = {
4677 topLevelScope: oldScope.topLevelScope,
4678 inTry: oldScope.inTry,
4679 inShorthand: false,
4680 inTaggedTemplateTag: false,
4681 isStrict: oldScope.isStrict,
4682 isAsmJs: oldScope.isAsmJs,
4683 terminated: oldScope.terminated,
4684 definitions: oldScope.definitions.createChild()
4685 };
4686
4687 fn();
4688
4689 const terminated = this.scope.terminated;
4690
4691 if (inExecutedPath && terminated) {
4692 oldScope.terminated = terminated;
4693 }
4694
4695 this.scope = oldScope;
4696 }
4697
4698 /**
4699 * Processes the provided statement.

Callers 10

walkBlockStatementMethod · 0.95
walkLabeledStatementMethod · 0.95
walkWithStatementMethod · 0.95
walkWhileStatementMethod · 0.95
walkDoWhileStatementMethod · 0.95
walkForStatementMethod · 0.95
walkForInStatementMethod · 0.95
walkForOfStatementMethod · 0.95
walkSwitchCasesMethod · 0.95
walkCatchClauseMethod · 0.95

Calls 2

createChildMethod · 0.80
fnFunction · 0.50

Tested by

no test coverage detected