Skip to content

Commit

Permalink
feat(api): export precompile() and allow passing AstModule[] in (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota authored Nov 6, 2024
1 parent 85416ae commit 7e6e938
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { enableFeatures, build } from "./pipeline/build";
export { precompile } from "./pipeline/precompile";
export {
TactError,
TactParseError,
Expand Down
4 changes: 3 additions & 1 deletion src/pipeline/precompile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ import { resolveErrors } from "../types/resolveErrors";
import { resolveSignatures } from "../types/resolveSignatures";
import { resolveImports } from "../imports/resolveImports";
import { VirtualFileSystem } from "../vfs/VirtualFileSystem";
import { AstModule } from "../grammar/ast";

export function precompile(
ctx: CompilerContext,
project: VirtualFileSystem,
stdlib: VirtualFileSystem,
entrypoint: string,
parsedModules?: AstModule[],
) {
// Load all sources
const imported = resolveImports({ entrypoint, project, stdlib });

// Add information about all the source code entries to the context
ctx = openContext(ctx, imported.tact, imported.func);
ctx = openContext(ctx, imported.tact, imported.func, parsedModules);

// First load type descriptors and check that
// they all have valid signatures
Expand Down

0 comments on commit 7e6e938

Please sign in to comment.