fnptrcalleetfn's N_DOT arm required an N_IDENT base, so a.b.cb(...) fell to the name registry with an empty module hint and emitted CALL cb(SB) (undefined symbol; cstage calls the stamped ptr indirect). dotbasestructinfo resolves the base chain through the struct registry — each link a struct- or *struct-typed field — and the single-dot path routes through the same resolver unchanged. Closes the last open shape of the #59.8 name-keyed callee family. Fixture fnptrfield_chain; corpus pin 1487/2974.
28 lines
576 B
Plaintext
28 lines
576 B
Plaintext
//ww:run-exit 36
|
|
package main;
|
|
|
|
// A call through a chained-DOT fn-ptr field (a.b.cb(...)). The wwstage
|
|
// callee resolver only accepted an N_IDENT base, so the chained shape
|
|
// fell to the name registry with an empty module hint and emitted
|
|
// CALL cb(SB) — the last open shape of the #59.8 name-keyed family.
|
|
|
|
type bstr = struct {
|
|
cb: *fn(x: i32) i32,
|
|
pad: i32,
|
|
};
|
|
|
|
type astr = struct {
|
|
n: i32,
|
|
b: bstr,
|
|
};
|
|
|
|
fn twice(x: i32) i32 = { return x * 2; };
|
|
|
|
fn main() i32 = {
|
|
let a: astr;
|
|
a.n = 1;
|
|
a.b.cb = &twice;
|
|
a.b.pad = 2;
|
|
return a.b.cb(20) + a.n + a.b.pad - 7;
|
|
};
|