Skip to content

Commit

Permalink
little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
x86y committed Oct 2, 2023
1 parent 0a14369 commit a65e736
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Binary file modified pkg/libfranca_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
5 changes: 3 additions & 2 deletions src/lib/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ fn transform_stmt(stmt: &Stmt) -> Vec<Stmt> {
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); }];
}
}
}
Expand Down

0 comments on commit a65e736

Please sign in to comment.