MCPcopy
hub / github.com/webpack/webpack / walkGuardedBranch

Method walkGuardedBranch

lib/javascript/JavascriptParser.js:2428–2440  ·  view source on GitHub ↗

* Walks a conditional branch with its guard frame (if any) pushed onto the * parser-state guard stack for the duration of the branch body. * @param {EXPECTED_OBJECT | undefined | null} frame guard frame, or falsy when the branch is unguarded * @param {() => void} walk branch walk * @returns

(frame, walk)

Source from the content-addressed store, hash-verified

2426 * @returns {void}
2427 */
2428 walkGuardedBranch(frame, walk) {
2429 if (!frame) {
2430 walk();
2431 return;
2432 }
2433 const stack = this.state.guardStack || (this.state.guardStack = []);
2434 stack.push(frame);
2435 try {
2436 walk();
2437 } finally {
2438 stack.pop();
2439 }
2440 }
2441
2442 /**
2443 * Processes the provided statement.

Callers 2

walkIfStatementMethod · 0.95

Calls 3

popMethod · 0.80
walkFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected