tree leaves are now editable. cleaning. removing redefine, since i can just eval() with :=

This commit is contained in:
Dustin Swan 2026-02-16 16:13:24 -07:00
parent a8a51718fc
commit f42b5d8abe
No known key found for this signature in database
GPG key ID: 30D46587E2100467
3 changed files with 81 additions and 45 deletions

View file

@ -113,12 +113,12 @@ export const _rt = {
}
syncToAst(name);
},
redefine: (name: string) => (code: string) => {
const tokens = tokenize(`_tmp = ${code};`);
const parser = new Parser(tokens, "");
const defs = parser.parse();
recompile(name, defs[0].body);
return { _tag: 'Ok' };
rebindAt: (pathStr: string) => (value: string) => {
const parts = pathStr.split('.');
const name = parts[0];
const path = parts.slice(1);
return { _tag: 'Rebind', _0: name, _1: path, _2: value };
},
undefine: (name: string) => {
delete store[name];