* Delphi form code-behind: a form unit `UFRMAbout.pas` owns its visual form * definition `UFRMAbout.dfm` (VCL) / `.fmx` (FireMonkey) — paired by basename in * the same directory, wired by the `{$R *.dfm}` directive rather than a `uses` * clause. Link the unit → its form so a `.dfm`/`.fmx` used on
(ctx: ResolutionContext, onYield: MaybeYield)
| 2004 | * definition isn't orphaned, and editing the form surfaces its code-behind unit. |
| 2005 | */ |
| 2006 | async function pascalFormEdges(ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]> { |
| 2007 | let scannedFiles = 0; |
| 2008 | const edges: Edge[] = []; |
| 2009 | const allFiles = new Set(ctx.getAllFiles()); |
| 2010 | for (const file of allFiles) { |
| 2011 | if ((++scannedFiles & 255) === 0) await onYield(); |
| 2012 | if (!/\.(dfm|fmx)$/i.test(file)) continue; |
| 2013 | const pasFile = file.replace(/\.(dfm|fmx)$/i, '.pas'); |
| 2014 | if (!allFiles.has(pasFile)) continue; |
| 2015 | const formNode = ctx.getNodesInFile(file).find((n) => n.kind === 'file'); |
| 2016 | const unitNode = ctx.getNodesInFile(pasFile).find((n) => n.kind === 'file'); |
| 2017 | if (!formNode || !unitNode) continue; |
| 2018 | edges.push({ |
| 2019 | source: unitNode.id, |
| 2020 | target: formNode.id, |
| 2021 | kind: 'references', |
| 2022 | line: unitNode.startLine, |
| 2023 | provenance: 'heuristic', |
| 2024 | metadata: { synthesizedBy: 'pascal-form', registeredAt: pasFile }, |
| 2025 | }); |
| 2026 | } |
| 2027 | return edges; |
| 2028 | } |
| 2029 | |
| 2030 | /** |
| 2031 | * SvelteKit file-convention data flow. A route directory's `+page.svelte` (a |
no test coverage detected