MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / li_boundary_2047

Function li_boundary_2047

tests/integration/vm_execution.rs:1282–1298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1280 program.name
1281 );
1282 }
1283}
1284
1285/// A struct field holding a function pointer is called as an expression
1286/// (`db.op(args)`), lowering to a field load plus an indirect call.
1287#[test]
1288fn struct_function_pointer_field_call() {
1289 let (_, outcome, _) = run_hll(
1290 r#"
1291type BinaryOp = (i32, i32) -> i32
1292add: (a: i32, b: i32) -> i32 { return a + b }
1293mul: (a: i32, b: i32) -> i32 { return a * b }
1294struct Ops { combine: BinaryOp }
1295main: () -> i32 {
1296 ops: Ops = Ops { .combine = add }
1297 if ops.combine(20, 22) != 42 { return 1 }
1298 ops.combine = mul
1299 if ops.combine(6, 7) != 42 { return 2 }
1300 return 0
1301}

Callers

nothing calls this directly

Calls 1

run_hllFunction · 0.70

Tested by

no test coverage detected