amalloc has 0 callers post-γ-2; the *arena threaded through
newnode/newscope/newtype/prim/typesinit/type{ptr,slice,array,chan,
named}/lexinit/parserinit/joindotted/checkinit/arenau64tos/cgeninit
and the scope.a / tctx.a / lex.a / parser.a / checker.a / cgen.a
fields are vestigial.
Drop `import mem;` from 15 files, remove six struct fields, strip
*arena from 14 signatures, update ~120 call sites across lib/ww +
wcc + w6c + wwdump. selfhost/test/sym_link.ww fixture drops the
newarena/freearena probe; still exits 42 on scopedefine/scopelookup.
Both main.combined.ww auto-regenerated.
Comments retidied: typ.ww "once per arena" → "once per program";
parse.ww drops "arena-build" qualifier on joindotted; sym.ww drops
mem-sibling-imports rationale.
Verified 132/132 incl. 994_w6c_ww + 995_self_rebuild byte-identity
(the primary symmetric-stages gate).
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
// selfhost/test/sym_link.ww — link-and-run probe for the ww-cgen
|
|
// against the sym/typ/ast dep stack. Exercises hashtable scope
|
|
// (sym), and pulls in typ/ast as type carriers.
|
|
// Returns 42 on success; smaller values name the probe that broke.
|
|
|
|
package test;
|
|
|
|
import typ;
|
|
import ast;
|
|
import sym;
|
|
|
|
export fn main() i32 = {
|
|
let s: *scope = newscope(nil);
|
|
if (s == nil) { return 2; };
|
|
|
|
let n1: str = "foo";
|
|
let r1: *sym = scopedefine(s, n1, skind.SK_VAR, nil, nil);
|
|
if (r1 == nil) { return 3; };
|
|
|
|
let n2: str = "bar";
|
|
let r2: *sym = scopedefine(s, n2, skind.SK_TYPE, nil, nil);
|
|
if (r2 == nil) { return 4; };
|
|
|
|
// Duplicate define in same scope must fail.
|
|
let r3: *sym = scopedefine(s, n1, skind.SK_VAR, nil, nil);
|
|
if (r3 != nil) { return 5; };
|
|
|
|
let l1: *sym = scopelookup(s, n1);
|
|
if (l1 == nil) { return 6; };
|
|
if (l1.skind != skind.SK_VAR) { return 7; };
|
|
|
|
let l2: *sym = scopelookup(s, n2);
|
|
if (l2 == nil) { return 8; };
|
|
if (l2.skind != skind.SK_TYPE) { return 9; };
|
|
|
|
// Not-found lookup returns nil.
|
|
let n3: str = "baz";
|
|
let l3: *sym = scopelookup(s, n3);
|
|
if (l3 != nil) { return 10; };
|
|
|
|
return 42;
|
|
};
|