eagerly load crates from extern mod items

This commit is contained in:
nora 2023-08-02 19:32:49 +02:00
parent 2f1f4a9798
commit e455e71aa2
2 changed files with 21 additions and 12 deletions

View file

@ -13,6 +13,7 @@ import { GlobalContext, parseArgs } from "./context";
import { loadCrate } from "./loader";
const INPUT = `
extern mod a;
type A = { a: Int };
function main() = (
@ -22,13 +23,8 @@ function main() = (
function printA(a: A) = (
print("ABCDEFGH\\n");
std.printlnInt(a.a);
print("ABCDEFGH\\n");
);
function linkStd() = (
std.println("a");
);
`;
function main() {
@ -47,12 +43,12 @@ function main() {
const gcx = new GlobalContext(opts, loadCrate);
const mainCrate = gcx.crateId.next();
gcx.crateLoader(gcx, "std", Span.startOfFile(file));
withErrorPrinter(
() => {
const start = Date.now();
gcx.crateLoader(gcx, "std", Span.startOfFile(file));
const tokens = tokenize(file);
if (debug.has("tokens")) {
console.log("-----TOKENS------------");