MCPcopy
hub / github.com/webpack/webpack / buildFrameFormula

Function buildFrameFormula

lib/dependencies/HarmonyImportGuard.js:208–224  ·  view source on GitHub ↗
(parser, frame)

Source from the content-addressed store, hash-verified

206 * @returns {GuardFormula | null} formula, or null when it has no knowable atom
207 */
208const buildFrameFormula = (parser, frame) => {
209 const HarmonyImportSpecifierDependency =
210 getHarmonyImportSpecifierDependency();
211 const deps = /** @type {Module} */ (parser.state.module).dependencies;
212 /** @type {Map<number, HarmonyImportSpecifierDependency>} */
213 const depByRangeStart = new Map();
214 for (let i = /** @type {number} */ (frame.depStart); i < deps.length; i++) {
215 const dep = deps[i];
216 if (dep instanceof HarmonyImportSpecifierDependency && dep.range) {
217 depByRangeStart.set(dep.range[0], dep);
218 }
219 }
220 return buildGuardFormula(
221 /** @type {Expression} */ (frame.test),
222 depByRangeStart
223 );
224};
225
226/**
227 * Tags a freshly created dependency with the active dependency guards.

Callers 1

attachDependencyGuardsFunction · 0.85

Calls 2

buildGuardFormulaFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected