feat(lang): L8 registries by declaration - registry and def
registry NAME of RECORD [as PREFIX] is a global table; def NAME key { ... } in
any file is one entry, collected in source order and filled before any code
runs. Each entry gets an index constant (PREFIX_KEY), the table PREFIX_COUNT,
and a record with a key field gets it filled and a NAME_find(key). A record
literal naming a field its record lacks is now an error everywhere; a global's
initializer is lowered as its own file's code (its errors, and what its module
may see, were whichever statement came last).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b0b0b62bce
commit
7e7f3ab297
15 changed files with 48231 additions and 44362 deletions
|
|
@ -78,6 +78,7 @@ function ck_new(e: Node) -> pointer {
|
|||
if r != null and fi.kind == E_FINIT {
|
||||
let ft = ck_field(r, fi.s)
|
||||
if ft != null { ck_give(ft, vt, fi.a, `field {fi.s} of {e.s}`) }
|
||||
if ft == null { ck_err("field", fi.a, `{gen_show(e.s)} has no field {fi.s}`) }
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue