File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,24 @@ mod tests {
317317 jit ( code) ;
318318 }
319319
320+ #[ test]
321+ fn test_call_id ( ) {
322+ let code = r#"
323+ assert(cond: bool) → void
324+
325+ id(x: i32) → i32 {
326+ x
327+ }
328+
329+ main {
330+ let y = id(42)
331+ // assert(y == 42)
332+ }
333+ "# ;
334+
335+ jit ( code) ;
336+ }
337+
320338 #[ test]
321339 fn test_neg ( ) {
322340 let code = r#"
Original file line number Diff line number Diff line change @@ -170,6 +170,11 @@ impl JIT {
170170
171171 let mut trans = FunctionTranslator :: new ( builder, & mut self . module ) ;
172172
173+ // Add variables for the function parameters.
174+ for param in & decl. params {
175+ trans. declare_variable ( & param. name , param. ty . expect ( "expected type" ) . cranelift_type ( ) ) ;
176+ }
177+
173178 trans. translate_fn ( decl, decls) ;
174179
175180 // Need a return instruction at the end of the function's block.
You can’t perform that action at this time.
0 commit comments