-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathengineCodegen.ts
More file actions
32 lines (30 loc) · 1.23 KB
/
Copy pathengineCodegen.ts
File metadata and controls
32 lines (30 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Engine-specific codegen seam.
*
* Lets an alternate-engine build inject setup code into the generated Python
* *after* the imports and *before* the blocks, without touching the shared
* code generation in pathsimRunner.ts. The default engine (pathsim) needs none,
* so this is a no-op that a re-engined build swaps out (like the worker-side
* engineInstall seam).
*
* Example (fastsim): emit class-level `port()` wraps for toolbox block classes,
* because fastsim's `Connection` only accepts fastsim blocks, so a pathsim
* toolbox block must be ported at the class level before any instance is built.
*/
/** A named block of setup lines emitted after imports, before block creation. */
export interface EngineSetup {
/** Section header, rendered as a `# <header>` comment (with a banner on export). */
header: string;
/** Python source lines for the section body. */
lines: string[];
}
/**
* Engine-specific setup code, given the block import groups (import path → class
* names) collected from the graph. Returns null when the engine needs no setup
* (the default), in which case no section is emitted.
*/
export function generateEngineSetup(
_importGroups: Map<string, Set<string>>
): EngineSetup | null {
return null;
}