Starting to add types
This commit is contained in:
parent
a8e879289d
commit
3132b79aae
5 changed files with 203 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue