* The scope's symbols, in the order their groups appear. * * For three of the four scopes that is the order the surface resolved them in, * because the surface is what knows how it found them: source order for a class, * selection order for a selection. For a closure it is the walk's own order,
(scope: PseudocodeScope, input: PseudocodeInput)
| 429 | * depend on which round trip won a race. |
| 430 | */ |
| 431 | function orderedScope(scope: PseudocodeScope, input: PseudocodeInput): ScopeEntry[] { |
| 432 | const byKey = new Map<string, SemanticIR>(); |
| 433 | for (const ir of input.irs) { |
| 434 | byKey.set(identityOf(ir.symbol), ir); |
| 435 | } |
| 436 | if (scope.kind !== 'closure' || input.closure === undefined) { |
| 437 | return input.irs.map((ir) => ({ key: identityOf(ir.symbol), name: ir.symbol.name, ir })); |
| 438 | } |
| 439 | return input.closure.symbols.map((symbol) => ({ |
| 440 | key: identityOf(symbol), |
| 441 | name: symbol.name, |
| 442 | ir: byKey.get(identityOf(symbol)), |
| 443 | })); |
| 444 | } |
| 445 | |
| 446 | /** How many symbols the block is missing because a bound cut the walk short. */ |
| 447 | function hiddenSymbolsOf(scope: PseudocodeScope, input: PseudocodeInput): number { |
no test coverage detected