(choiceId: string)
| 508 | const importableVisiting = new Set<string>(); |
| 509 | |
| 510 | const isChoiceImportable = (choiceId: string): boolean => { |
| 511 | const finalizeImportable = (isImportable: boolean): boolean => { |
| 512 | importableCache.set(choiceId, isImportable); |
| 513 | importableVisiting.delete(choiceId); |
| 514 | return isImportable; |
| 515 | }; |
| 516 | |
| 517 | if (importableCache.has(choiceId)) { |
| 518 | return importableCache.get(choiceId) as boolean; |
| 519 | } |
| 520 | |
| 521 | if (importableVisiting.has(choiceId)) { |
| 522 | // Break potential cycles by treating the current path as importable. |
| 523 | return true; |
| 524 | } |
| 525 | |
| 526 | importableVisiting.add(choiceId); |
| 527 | |
| 528 | const decision = choiceDecisionMap.get(choiceId); |
| 529 | if (decision === "skip") { |
| 530 | return finalizeImportable(false); |
| 531 | } |
| 532 | |
| 533 | const entry = catalog.get(choiceId); |
| 534 | if (!entry) { |
| 535 | return finalizeImportable(false); |
| 536 | } |
| 537 | |
| 538 | const parentId = entry.parentChoiceId; |
| 539 | if (!parentId) { |
| 540 | return finalizeImportable(true); |
| 541 | } |
| 542 | |
| 543 | if (!catalog.has(parentId)) { |
| 544 | return finalizeImportable(true); |
| 545 | } |
| 546 | |
| 547 | const parentDecision = choiceDecisionMap.get(parentId); |
| 548 | if (parentDecision === "skip") { |
| 549 | return finalizeImportable(true); |
| 550 | } |
| 551 | |
| 552 | const result = isChoiceImportable(parentId); |
| 553 | return finalizeImportable(result); |
| 554 | }; |
| 555 | |
| 556 | for (const entry of pkg.choices) { |
| 557 | if (isChoiceImportable(entry.choice.id)) { |
no test coverage detected