(parser, dep)
| 229 | * @param {GuardableDependency} dep the dependency |
| 230 | */ |
| 231 | const attachDependencyGuards = (parser, dep) => { |
| 232 | const stack = /** @type {GuardFrame[] | undefined} */ ( |
| 233 | parser.state.guardStack |
| 234 | ); |
| 235 | if (stack === undefined || stack.length === 0) return; |
| 236 | /** @type {DependencyGuard[] | undefined} */ |
| 237 | let guards; |
| 238 | for (const frame of stack) { |
| 239 | if (frame.depStart === undefined) continue; |
| 240 | let formula = frame.formula; |
| 241 | if (formula === undefined) { |
| 242 | formula = frame.formula = buildFrameFormula(parser, frame); |
| 243 | } |
| 244 | if (formula === null) continue; |
| 245 | (guards || (guards = [])).push({ |
| 246 | formula, |
| 247 | value: /** @type {boolean} */ (frame.condition) |
| 248 | }); |
| 249 | } |
| 250 | if (guards !== undefined) dep.branchGuards = guards; |
| 251 | }; |
| 252 | |
| 253 | module.exports.attachDependencyGuards = attachDependencyGuards; |
| 254 | module.exports.isDeadByGuards = isDeadByGuards; |
nothing calls this directly
no test coverage detected