This commit is contained in:
parent
6bb68863ca
commit
0655f398ce
32
src/front/check2.ts
Normal file
32
src/front/check2.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { Syms } from "./resolve.ts";
|
||||||
|
import * as ast from "../ast.ts";
|
||||||
|
import { Ty } from "../ty.ts";
|
||||||
|
|
||||||
|
export function checkFn(fn: ast.FnStmt, syms: Syms) {
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FnTys {
|
||||||
|
constructor(
|
||||||
|
private nodeTys: Map<ast.Node, Ty>,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
get(node: ast.Node): Ty {
|
||||||
|
const ty = this.nodeTys.get(node);
|
||||||
|
if (ty === undefined) {
|
||||||
|
throw new Error(`no type for '${node.kind.tag}'`);
|
||||||
|
}
|
||||||
|
return ty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FnChecker {
|
||||||
|
private nodeTys = new Map<ast.Node, Ty>();
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private fn: ast.FnStmt,
|
||||||
|
private syms: Syms,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
export * from "./parse.ts";
|
export * from "./parse.ts";
|
||||||
export * from "./resolve.ts";
|
export * from "./resolve.ts";
|
||||||
export * from "./check.ts";
|
export * from "./check.ts";
|
||||||
|
export * from "./check2.ts";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user