(ancestors, state, moduleGraph, ctx)
| 360 | * @returns {ConnectionState} the root ancestor's result |
| 361 | */ |
| 362 | const propagateLinearResult = (ancestors, state, moduleGraph, ctx) => { |
| 363 | if (ancestors === null) return state; |
| 364 | while (ancestors.length > 0) { |
| 365 | const dep = /** @type {Dependency} */ (ancestors.pop()); |
| 366 | const ancestor = /** @type {NormalModule} */ (ancestors.pop()); |
| 367 | ancestor._isEvaluatingSideEffects = false; |
| 368 | |
| 369 | if (state === true) { |
| 370 | recordSideEffectsBailout(ancestor, moduleGraph, dep); |
| 371 | // `true` is monotonic — safe to cache regardless of cycle status. |
| 372 | ancestor._sideEffectsStateGraph = moduleGraph; |
| 373 | ancestor._sideEffectsStateValue = true; |
| 374 | } else if (state === ModuleGraphConnection.CIRCULAR_CONNECTION) { |
| 375 | // CIRCULAR_CONNECTION is filtered before folding into `current`, |
| 376 | // so the ancestor's `current` stays at its initial `false`. From |
| 377 | // this point upward the propagated state is `false`, and the |
| 378 | // cycle taint prevents memoization further up (handled by |
| 379 | // `ctx.circular`). |
| 380 | state = false; |
| 381 | } else if (!ctx.circular) { |
| 382 | ancestor._sideEffectsStateGraph = moduleGraph; |
| 383 | ancestor._sideEffectsStateValue = state; |
| 384 | } |
| 385 | } |
| 386 | return state; |
| 387 | }; |
| 388 | |
| 389 | /** |
| 390 | * Recursive form of the side-effects walker. Folds the descent through |
no test coverage detected