Fix for-loops
This commit is contained in:
parent
5831b06af5
commit
14537743ed
@ -1,12 +1,16 @@
|
|||||||
// Arithmetic, function calls and imports!
|
// Arithmetic, function calls and imports!
|
||||||
|
|
||||||
import std::print;
|
import std::print;
|
||||||
import std::from_str;
|
import std::new_string;
|
||||||
|
import std::add_num_to_str;
|
||||||
|
import std::free_string;
|
||||||
|
|
||||||
fn main() -> u32 {
|
fn main() -> u32 {
|
||||||
let text = from_str("hello");
|
for i in 0 .. 5 {
|
||||||
for i in 0 .. 10 {
|
let mut text = new_string();
|
||||||
print(&text)
|
add_num_to_str(&mut text, i);
|
||||||
|
print(&text);
|
||||||
|
free_string(&mut text);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut num = 0;
|
let mut num = 0;
|
||||||
|
@ -186,7 +186,7 @@ impl ast::Block {
|
|||||||
counter_range.as_meta(module_id),
|
counter_range.as_meta(module_id),
|
||||||
);
|
);
|
||||||
let mut block = block.into_mir(module_id);
|
let mut block = block.into_mir(module_id);
|
||||||
block.statements.insert(0, set_new);
|
block.statements.push(set_new);
|
||||||
(
|
(
|
||||||
StmtKind::While(WhileStatement {
|
StmtKind::While(WhileStatement {
|
||||||
condition: mir::Expression(
|
condition: mir::Expression(
|
||||||
|
Loading…
Reference in New Issue
Block a user