dirname/basename ported verbatim from ref/hare/path/posix.ha:17,37, re-routing Hare's byte scanning to bytes.rtrim/rindex. Additive to the c2-stack buffer core; no harness/Makefile/module-const changes. Work-var renamed path->p to avoid Hare's param-shadowing `let path = toutf8(path)`: ww's cgen N_LET prepends the new local into the name-keyed localfind chain BEFORE the init is emitted, so the shadow-init reads the fresh uninit slot — a silent miscompile, both-wrong-identical, filed #152 and fixed independently next. drew ruled path->p a permanent acceptable spelling (internal work-var, not API surface; avoids a param-shadow footgun; not a rule-7 workaround). WHY-comment + #152 pointer at both sites. Tests: 10-row dirname/basename table (posix.ha:51-71 verbatim) — root, no-sep, empty, trailing-sep, multi-sep all covered, expecteds traced. C-first: cstage @test green; the str-view-vs-literal rows are #146-deferred (wwstage byte-id, rides #125). Gate: all 324 passed, byte-id 990-997 green, w6c/w6c_ww unchanged (lib-only additive).
6.3 KiB
6.3 KiB