//! > simple closure.
//! > test_runner_name
test_function_lowering(expect_diagnostics: false)
//! > function_code
fn foo(a: felt252) -> felt252 {
let c = |a| {
a + 3
};
c(2)
}
//! > function_name
foo
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v0: core::felt252
blk0 (root):
Statements:
(v1: core::felt252) <- 5
End:
Return(v1)
//! > ==========================================================================
//! > using captured copiable variable.
//! > test_runner_name
test_function_lowering(expect_diagnostics: false)
//! > function_code
fn foo() -> felt252 {
let x = 8;
let c = |a| {
x * (a + 3)
};
let y = c(2);
y + x
}
//! > function_name
foo
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters:
blk0 (root):
Statements:
(v0: core::felt252) <- 48
End:
Return(v0)