Skip to content

Commit

Permalink
fix: break and continue statements (tempfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcoury committed Jul 12, 2024
1 parent b32460a commit ee7d94d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transpiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ impl JsTranspiler {
let mut res = String::new();
for (i, stmt) in stmts.iter().enumerate() {
let stmt_str = self.generate_stmt(stmt)?;
if i < stmts.len() - 1 {
// TODO: improve break and continue detection
if i < stmts.len() - 1 || stmt_str.contains("break") || stmt_str.contains("continue") {
res.push_str(&format!("{};", stmt_str));
} else {
res.push_str(&format!("return {};", stmt_str));
Expand Down

0 comments on commit ee7d94d

Please sign in to comment.