diff --git a/pkg/libfranca_bg.wasm b/pkg/libfranca_bg.wasm index a252b70..a625bd7 100644 Binary files a/pkg/libfranca_bg.wasm and b/pkg/libfranca_bg.wasm differ diff --git a/src/bin/main.rs b/src/bin/main.rs index 500199b..0618918 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -3,6 +3,6 @@ use libfranca::loops::mkterse; fn main() { - let i = mkterse("fn a() { let a = 5; let mut b = 10; }".into()); + let i = mkterse("fn a() { let a = &mut 5; let mut b = 10; }".into()); println!("{i}"); } diff --git a/src/lib/loops.rs b/src/lib/loops.rs index 815455a..d94e678 100644 --- a/src/lib/loops.rs +++ b/src/lib/loops.rs @@ -25,10 +25,11 @@ fn transform_stmt(stmt: &Stmt) -> Vec { let init = init.as_ref().unwrap(); let expr = &init.expr; if let syn::Pat::Ident(ident) = pat { + let var_ident = &ident.ident; if ident.mutability.is_some() { - return vec![parse_quote! { lm!(#expr); }]; + return vec![parse_quote! { lm!(#var_ident, #expr); }]; } else { - return vec![parse_quote! { l!(#expr); }]; + return vec![parse_quote! { l!(#var_ident, #expr); }]; } } }