MCPcopy Create free account
hub / github.com/chc4/lineiform / function_inc_codegen

Function function_inc_codegen

tangle/src/ir.rs:284–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

282
283 #[test]
284 pub fn function_inc_codegen() {
285 let mut ir = IR::new();
286 let mut f = Node::function::<1, 1>(&mut ir);
287 let port = f.add_argument(&mut ir);
288 let ret_port = f.add_return(&mut ir);
289 let mut inc = Node::simple(Operation::Inc);
290 f.add_body(inc, &mut ir, |inc, r| {
291 inc.connect_input(0, port, r);
292 inc.connect_output(0, ret_port, r);
293 });
294 ir.set_body(f);
295 let hello_fn: extern "C" fn(usize) -> usize = ir.compile_fn().unwrap().0;
296 assert_eq!(hello_fn(1), 2);
297 }
298
299 #[test]
300 pub fn function_add_codegen() {

Callers

nothing calls this directly

Calls 7

add_argumentMethod · 0.80
add_returnMethod · 0.80
add_bodyMethod · 0.80
connect_inputMethod · 0.80
connect_outputMethod · 0.80
set_bodyMethod · 0.80
compile_fnMethod · 0.80

Tested by

no test coverage detected