Skip to content

Commit

Permalink
fix: let without value now works
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmasoldi3r committed Dec 7, 2023
1 parent 288cec3 commit 9c037ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lua/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,13 @@ impl Visitor for LuaEmitter {
self.gen_destruct(ctx, stmt.value.as_ref().unwrap(), e)?
}
ast::AssignmentTarget::Identifier(e) => {
let ctx = ctx.line().put("local ").put(e.0.clone()).put(" = ");
let ctx = self.visit_expression(ctx, stmt.value.as_ref().unwrap())?;
let ctx = ctx.line().put("local ").put(e.0.clone());
let ctx = if let Some(value) = &stmt.value {
let ctx = ctx.put(" = ");
self.visit_expression(ctx, value)?
} else {
ctx
};
ctx.put(";")
}
};
Expand Down

0 comments on commit 9c037ac

Please sign in to comment.