ad00114c7fc3ae6e521b3d8a1d60eca99b14ce8e
The #258 borrow desugar lowers `let s: []T = arr` to a runtime `arr[0:len]` (N_SLICE over the array base) so the slice header is built at run time. That is only meaningful for a LOCAL let — a fn body executes the borrow. A module-level let is static data with no runtime to run the borrow; its rhs must stay the raw N_ARRLIT so cgen can materialize it as DATA. cstage splits this by checker: clet (the desugar site, check.c:1993) runs only from cstmt (local statements); module-level lets are checked in check_file pass-2 (check.c:2549) which never desugars. wwstage runs ONE checkletassign for both — function-body lets via resolvewalk's post-order walk (a block scope is pushed, c.cur != c.top) and top-level lets via checkfile pass-2 (no scope pushed, c.cur == c.top). Mirror cstage's split by gating the desugar call on `c.cur != c.top` (the same module-scope test as check.ww:184). The #130 module-level assignability check in checkletassign is untouched. Without this, a module-level `let g: []u8 = [1u8,2u8,3u8]` reached cgen as N_SLICE in wwstage but N_ARRLIT in cstage — the cs!=ww shape that blocked #10 part-a's wwstage data-emission. Locals stay byte-identical (named-array->slice still works, exit 8 both stages); selfhost combined .ww regenerated.
Description
No description provided
Languages
C
89.4%
Python
7.2%
Makefile
2.3%
Shell
0.8%
Assembly
0.3%