Skip to content

Commit 7e6e938

Browse files
authored
feat(api): export precompile() and allow passing AstModule[] in (#984)
1 parent 85416ae commit 7e6e938

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { enableFeatures, build } from "./pipeline/build";
2+
export { precompile } from "./pipeline/precompile";
23
export {
34
TactError,
45
TactParseError,

src/pipeline/precompile.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ import { resolveErrors } from "../types/resolveErrors";
77
import { resolveSignatures } from "../types/resolveSignatures";
88
import { resolveImports } from "../imports/resolveImports";
99
import { VirtualFileSystem } from "../vfs/VirtualFileSystem";
10+
import { AstModule } from "../grammar/ast";
1011

1112
export function precompile(
1213
ctx: CompilerContext,
1314
project: VirtualFileSystem,
1415
stdlib: VirtualFileSystem,
1516
entrypoint: string,
17+
parsedModules?: AstModule[],
1618
) {
1719
// Load all sources
1820
const imported = resolveImports({ entrypoint, project, stdlib });
1921

2022
// Add information about all the source code entries to the context
21-
ctx = openContext(ctx, imported.tact, imported.func);
23+
ctx = openContext(ctx, imported.tact, imported.func, parsedModules);
2224

2325
// First load type descriptors and check that
2426
// they all have valid signatures

0 commit comments

Comments
 (0)