Implement missing CStmts
This commit is contained in:
parent
52b349ce87
commit
84ccd167f7
1 changed files with 15 additions and 1 deletions
|
|
@ -225,7 +225,21 @@ impl Transpiler {
|
|||
output.push_str(" }\n");
|
||||
output
|
||||
}
|
||||
_ => "// TODO: unimplemented stmt\n".to_string(),
|
||||
|
||||
CStmt::For(init, cond, incr, body) => {
|
||||
let mut output = format!("for ({}, {}, {}) {{", self.generate_var_decl(init), self.generate_expr(cond), self.generate_expr(incr));
|
||||
for stmt in body {
|
||||
output.push_str(&format!(" {}", self.generate_stmt(stmt)));
|
||||
}
|
||||
output.push_str(" }\n");
|
||||
output
|
||||
}
|
||||
CStmt::Break => {
|
||||
"break;\n".to_string()
|
||||
}
|
||||
CStmt::Continue => {
|
||||
"continue;\n".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue