selfhost/cmd: astrndup → strings.dup view (γ-2); drop wcc.astrndup

The final 2 astrndup callers in w6a (main.ww fname capture and the
dupstr wrapper in parse.ww) now use the uniform γ-1 shape:

    let view: str;
    view.ptr = src;
    view.len = n: i32;
    out = strings.dup(view);

With both call sites converted, wcc.astrndup is dead and removed
from selfhost/cmd/wcc/mem.ww. amalloc + arena bootstrap stay
(other callers; #7 Phase B/C territory).

The two `// astrndup until #11 (w6a types shadow) is fixed.`
WHY-pointers are obsolete (#11 landed in 6696e95) and dropped per
CLAUDE.md rule 8.

dupstr in parse.ww keeps its (*arena, *u8, u64) signature; the
vestigial *arena param is tracked by task #10.

Verified 132/132 incl. 991_w6a_ww + 995_self_rebuild byte-identity.
This commit is contained in:
2026-05-21 11:21:07 +09:00
parent 6696e95da4
commit 3dae4d9e9a
8 changed files with 1951 additions and 116 deletions

View File

@@ -14,6 +14,7 @@ package w6a;
import os;
import mem;
import strings;
import lex;
import opcodes;
@@ -179,9 +180,11 @@ fn perr(a: *asm_, msg: str) void = {
};
// dupstr — copy n bytes from p into a fresh heap str.
// astrndup until #11 (w6a types shadow) is fixed.
fn dupstr(a: *arena, p: *u8, n: u64) str = {
return astrndup(a, p, n);
let view: str;
view.ptr = p;
view.len = n: i32;
return strings.dup(view);
};
// ---- line iteration & whitespace --------------------------------------