This commit is contained in:
nora 2023-07-29 21:32:35 +02:00
parent 761f78de0b
commit 09ae6cbb56
5 changed files with 6 additions and 7 deletions

View file

@ -58,7 +58,7 @@ export type ExprLet = {
type?: Type; type?: Type;
rhs: Expr; rhs: Expr;
// IMPORTANT: This is (sadly) shared with ExprBlock. // IMPORTANT: This is (sadly) shared with ExprBlock.
local?: LocalInfo, local?: LocalInfo;
}; };
export type ExprBlock = { export type ExprBlock = {

View file

@ -42,8 +42,7 @@ function main() {
console.log("-----AST typecked------"); console.log("-----AST typecked------");
const typecked = typeck(resolved); const typecked = typeck(resolved);
console.dir(typecked, {depth: 8}); console.dir(typecked, { depth: 8 });
console.log("-----wasm--------------"); console.log("-----wasm--------------");
const wasmModule = lowerToWasm(typecked); const wasmModule = lowerToWasm(typecked);

View file

@ -629,7 +629,7 @@ function addRt(cx: Context, ast: Ast) {
{ kind: "local.get", imm: 0 }, { kind: "local.get", imm: 0 },
{ kind: "i32.store", imm: { offset: 0, align: 4 } }, { kind: "i32.store", imm: { offset: 0, align: 4 } },
// get the length and store it in the iovec // get the length and store it in the iovec
{ kind: "i32.const", imm: iovecArray + 4 }, { kind: "i32.const", imm: iovecArray + 4 },
{ kind: "local.get", imm: 1 }, { kind: "local.get", imm: 1 },
{ kind: "i32.store", imm: { offset: 0, align: 4 } }, { kind: "i32.store", imm: { offset: 0, align: 4 } },
// now call stuff // now call stuff

View file

@ -316,7 +316,7 @@ export class InferContext {
public resolveIfPossible(ty: Ty): Ty { public resolveIfPossible(ty: Ty): Ty {
// TODO: dont be shallow resolve // TODO: dont be shallow resolve
// note that fixing this will cause cycles. fix those cycles instead using // note that fixing this will cause cycles. fix those cycles instead using
// he fancy occurs check as errs called it. // he fancy occurs check as errs called it.
if (ty.kind === "var") { if (ty.kind === "var") {
return this.tryResolveVar(ty.index) ?? ty; return this.tryResolveVar(ty.index) ?? ty;

View file

@ -1,3 +1,3 @@
export function encodeUtf8(s: string): Uint8Array { export function encodeUtf8(s: string): Uint8Array {
return new TextEncoder().encode(s); return new TextEncoder().encode(s);
} }