Files
ww/test/wcc/data/r809idx_callee_capture/case.ww
Hojun-Cho d456263f7e test/wcc/data: grow the declarative compiler corpus to 1,224 fixtures
The r-prefixed waves absorb the runtime, reject, and byte-compare rows
of the migrated native carriers; each fixture is one directory with one
case.ww and a //ww:error, //ww:compile, //ww:run, or //ww:run-exit
directive covering both frontends.
2026-08-07 23:21:04 +09:00

20 lines
1.3 KiB
Plaintext

//ww:run-exit 197
package main;
import strings;
type capture = struct { content: str, start: size, start_bytesize: size, end: size, end_bytesize: size };
type thr = struct { pc: size, caps: []capture };
fn store(ts: *[]thr, i: size, idx: size) void = { (*ts)[i].caps[idx] = capture { content = "grp", start = 3: size, start_bytesize = 4: size, end = 60: size, end_bytesize = 61: size }; };
export fn main() i32 = {
let cs: []capture = [];
append(cs, capture { content = "a", start = 1: size, start_bytesize = 1: size, end = 1: size, end_bytesize = 1: size });
append(cs, capture { content = "b", start = 2: size, start_bytesize = 2: size, end = 2: size, end_bytesize = 2: size });
append(cs, capture { content = "c", start = 9: size, start_bytesize = 9: size, end = 9: size, end_bytesize = 9: size });
let ts: []thr = []; append(ts, thr { pc = 5: size, caps = cs }); store(&ts, 0: size, 1: size);
if (strings.compare(ts[0].caps[1].content, "grp") != 0) { return 250; };
if (len(ts[0].caps[1].content) != 3) { return 249; };
if (ts[0].caps[0].end != 1 || ts[0].caps[2].start != 9) { return 248; };
if (strings.compare(ts[0].caps[2].content, "c") != 0) { return 247; };
let acc = ts[0].caps[1].start + ts[0].caps[1].start_bytesize + ts[0].caps[1].end + ts[0].caps[1].end_bytesize + ts[0].caps[1].start * 23;
return acc: i32;
};