* Build the end cap for a path that stopped short. * * `reports` comes from the shared detector, so the form, the key and the * candidate targets are the ones `codegraph_explore` would print. Everything * else on the cap is graph state around the stopping symbol: the calls it makes * that this
( cg: CodeGraph, stop: Node, reports: readonly NodeBoundary[], missed: readonly Node[], onPath: ReadonlySet<string> )
| 579 | * guess left invisible reads as "there is nothing here". |
| 580 | */ |
| 581 | function buildBoundary( |
| 582 | cg: CodeGraph, |
| 583 | stop: Node, |
| 584 | reports: readonly NodeBoundary[], |
| 585 | missed: readonly Node[], |
| 586 | onPath: ReadonlySet<string> |
| 587 | ): WireFlowBoundary { |
| 588 | const sites: WireBoundarySite[] = []; |
| 589 | for (const report of reports) { |
| 590 | for (const site of report.sites) { |
| 591 | if (sites.length >= MAX_SITES_PER_FLOW) break; |
| 592 | sites.push({ |
| 593 | form: site.form, |
| 594 | label: site.label, |
| 595 | snippet: site.snippet, |
| 596 | line: site.line, |
| 597 | key: site.key ?? null, |
| 598 | keyIsType: site.keyIsType === true, |
| 599 | moreSites: site.moreSites ?? 0, |
| 600 | candidates: site.candidates.map((c) => ({ |
| 601 | node: toNodeRef(c.node), |
| 602 | display: c.display, |
| 603 | named: c.named, |
| 604 | })), |
| 605 | candidateNote: site.candidateNote, |
| 606 | }); |
| 607 | } |
| 608 | } |
| 609 | const { resolved, uncertain } = continuationsFrom(cg, stop, onPath); |
| 610 | return { |
| 611 | node: toNodeRef(stop), |
| 612 | sites, |
| 613 | uncertain: wireList(uncertain.slice(0, MAX_CONTINUATIONS).map(toContinuation), uncertain.length), |
| 614 | further: wireList(resolved.slice(0, MAX_CONTINUATIONS).map(toContinuation), resolved.length), |
| 615 | missed: missed.slice(0, MAX_MISSED).map(toNodeRef), |
| 616 | }; |
| 617 | } |
| 618 | |
| 619 | /** |
| 620 | * The edge that already connects two symbols the reader walked between. |