33 lines
633 B
TypeScript
33 lines
633 B
TypeScript
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() {
|
|
}
|
|
}
|