mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
CHECK THE TYPES
This commit is contained in:
parent
35f1c92e36
commit
5c6ade6cbb
6 changed files with 670 additions and 18 deletions
|
|
@ -10,7 +10,14 @@ import {
|
|||
} from "./ast";
|
||||
import { CompilerError } from "./error";
|
||||
|
||||
const BUILTINS = new Set<string>(["print", "String"]);
|
||||
const BUILTINS = new Set<string>([
|
||||
"print",
|
||||
"String",
|
||||
"Int",
|
||||
"Bool",
|
||||
"true",
|
||||
"false",
|
||||
]);
|
||||
|
||||
export function resolve(ast: Ast): Ast {
|
||||
const items = new Map<string, number>();
|
||||
|
|
@ -60,9 +67,9 @@ export function resolve(ast: Ast): Ast {
|
|||
}
|
||||
|
||||
if (BUILTINS.has(ident.name)) {
|
||||
return { kind: "builtin" };
|
||||
return { kind: "builtin", name: ident.name };
|
||||
}
|
||||
|
||||
|
||||
throw new CompilerError(`cannot find ${ident.name}`, ident.span);
|
||||
};
|
||||
|
||||
|
|
@ -92,6 +99,7 @@ export function resolve(ast: Ast): Ast {
|
|||
returnType,
|
||||
body,
|
||||
},
|
||||
id: item.id,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue