This commit is contained in:
Alessandro Mauri 2024-10-31 13:04:30 +01:00
parent f48151b38e
commit 28598f0575
6 changed files with 106 additions and 8 deletions

View file

@ -24,6 +24,14 @@ macro Ctx.get_elem(&ctx, Id id)
return c_elem;
}
// this searches an element in the cache by label, it does not create a new element
// if it does't find one
macro Ctx.get_elem_by_label(&ctx, String label)
{
Id id = hash(label);
return ctx.cache.search(id);
}
fn void! Ctx.init(&ctx)
{
ctx.tree.init(MAX_ELEMENTS)!;