mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
refactorings
This commit is contained in:
parent
7eeaf548d0
commit
2f1f4a9798
12 changed files with 85 additions and 100 deletions
10
src/index.ts
10
src/index.ts
|
|
@ -1,4 +1,4 @@
|
|||
import { LoadedFile, withErrorPrinter } from "./error";
|
||||
import { LoadedFile, Span, withErrorPrinter } from "./error";
|
||||
import { isValidIdent, tokenize } from "./lexer";
|
||||
import { lower as lowerToWasm } from "./lower";
|
||||
import { ParseState, parse } from "./parser";
|
||||
|
|
@ -13,8 +13,6 @@ import { GlobalContext, parseArgs } from "./context";
|
|||
import { loadCrate } from "./loader";
|
||||
|
||||
const INPUT = `
|
||||
extern mod std;
|
||||
|
||||
type A = { a: Int };
|
||||
|
||||
function main() = (
|
||||
|
|
@ -49,6 +47,8 @@ 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();
|
||||
|
|
@ -93,7 +93,9 @@ function main() {
|
|||
if (debug.has("wat")) {
|
||||
console.log("-----wasm--------------");
|
||||
}
|
||||
const wasmModule = lowerToWasm([typecked, ...gcx.depCrates]);
|
||||
|
||||
gcx.finalizedCrates.push(typecked);
|
||||
const wasmModule = lowerToWasm(gcx);
|
||||
const moduleStringColor = writeModuleWatToString(wasmModule, true);
|
||||
const moduleString = writeModuleWatToString(wasmModule);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue