Starting to add types

This commit is contained in:
Dustin Swan 2026-03-25 19:58:37 -06:00
parent a8e879289d
commit 3132b79aae
No known key found for this signature in database
GPG key ID: 30D46587E2100467
5 changed files with 203 additions and 9 deletions

View file

@ -209,7 +209,7 @@ export const _rt = {
const fullCode = trimmed.endsWith(';') ? trimmed : trimmed + ';';
const tokens = tokenize(fullCode);
const parser = new Parser(tokens, fullCode);
const defs = parser.parse();
const { definitions: defs } = parser.parse();
if (defs.length > 0) {
const def = defs[0];
@ -229,7 +229,7 @@ export const _rt = {
const wrapped = `_expr = ${trimmed};`;
const tokens = tokenize(wrapped);
const parser = new Parser(tokens, wrapped);
const defs = parser.parse();
const { definitions: defs } = parser.parse();
const ast = defs[0].body;
// validate free vars
@ -275,7 +275,7 @@ export function loadDefinitions() {
for (const [_, source] of Object.entries(saved)) {
const tokens = tokenize(source as string);
const parser = new Parser(tokens, source as string);
const defs = parser.parse();
const { definitions: defs } = parser.parse();
if (defs.length > 0) {
recompile(defs[0].name, defs[0].body);
}