(blockId: string, currentNodeId?: string)
| 66 | } |
| 67 | |
| 68 | getBlockOutput(blockId: string, currentNodeId?: string): NormalizedBlockOutput | undefined { |
| 69 | const normalizedId = normalizeLookupId(blockId) |
| 70 | if (normalizedId !== blockId) { |
| 71 | return this.blockStates.get(blockId)?.output |
| 72 | } |
| 73 | |
| 74 | if (currentNodeId) { |
| 75 | const scopedOutput = this.getScopedBlockOutput(blockId, currentNodeId) |
| 76 | if (scopedOutput !== undefined) { |
| 77 | return scopedOutput |
| 78 | } |
| 79 | |
| 80 | if (extractOuterBranchIndex(currentNodeId) !== undefined) { |
| 81 | return undefined |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | const direct = this.blockStates.get(blockId)?.output |
| 86 | if (direct !== undefined) { |
| 87 | return direct |
| 88 | } |
| 89 | |
| 90 | if (currentNodeId && extractBranchSuffix(currentNodeId) === '') { |
| 91 | const stableBranchZeroOutput = this.blockStates.get( |
| 92 | buildOuterBranchScopedId(blockId, 0) |
| 93 | )?.output |
| 94 | if (stableBranchZeroOutput !== undefined) { |
| 95 | return stableBranchZeroOutput |
| 96 | } |
| 97 | |
| 98 | const branchZeroOutput = this.blockStates.get( |
| 99 | `${blockId}₍0₎${extractLoopSuffix(currentNodeId)}` |
| 100 | )?.output |
| 101 | if (branchZeroOutput !== undefined) { |
| 102 | return branchZeroOutput |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | for (const [storedId, state] of this.blockStates.entries()) { |
| 107 | if (normalizeLookupId(storedId) === blockId) { |
| 108 | return state.output |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | return undefined |
| 113 | } |
| 114 | |
| 115 | private getScopedBlockOutput( |
| 116 | blockId: string, |
nothing calls this directly
no test coverage detected