Fix for loops causing issues together
This commit is contained in:
parent
5464bba17e
commit
87a8eac61b
@ -1,9 +1,11 @@
|
|||||||
import std::print;
|
import std::print;
|
||||||
|
import std::from_str;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for i in 0..1 {
|
for i in 0..1 {
|
||||||
print("Hello!");
|
print(from_str("Hello!"));
|
||||||
}
|
}
|
||||||
for i in 0..1 {
|
for i in 0..1 {
|
||||||
print("World!");
|
print(from_str("Hello!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -158,7 +158,6 @@ impl ast::Block {
|
|||||||
StmtKind::Let(counter_var.clone(), true, start.process(module_id)),
|
StmtKind::Let(counter_var.clone(), true, start.process(module_id)),
|
||||||
counter_range.as_meta(module_id),
|
counter_range.as_meta(module_id),
|
||||||
);
|
);
|
||||||
mir_statements.push(let_statement);
|
|
||||||
|
|
||||||
let set_new = mir::Statement(
|
let set_new = mir::Statement(
|
||||||
StmtKind::Set(
|
StmtKind::Set(
|
||||||
@ -187,7 +186,7 @@ impl ast::Block {
|
|||||||
);
|
);
|
||||||
let mut block = block.into_mir(module_id);
|
let mut block = block.into_mir(module_id);
|
||||||
block.statements.push(set_new);
|
block.statements.push(set_new);
|
||||||
(
|
let while_statement = mir::Statement(
|
||||||
StmtKind::While(WhileStatement {
|
StmtKind::While(WhileStatement {
|
||||||
condition: mir::Expression(
|
condition: mir::Expression(
|
||||||
mir::ExprKind::BinOp(
|
mir::ExprKind::BinOp(
|
||||||
@ -203,8 +202,18 @@ impl ast::Block {
|
|||||||
block,
|
block,
|
||||||
meta: self.2.as_meta(module_id),
|
meta: self.2.as_meta(module_id),
|
||||||
}),
|
}),
|
||||||
self.2,
|
self.2.as_meta(module_id),
|
||||||
)
|
);
|
||||||
|
|
||||||
|
let inner_scope = StmtKind::Expression(mir::Expression(
|
||||||
|
mir::ExprKind::Block(mir::Block {
|
||||||
|
statements: vec![let_statement, while_statement],
|
||||||
|
return_expression: None,
|
||||||
|
meta: counter_range.as_meta(module_id) + end.1.as_meta(module_id),
|
||||||
|
}),
|
||||||
|
counter_range.as_meta(module_id) + end.1.as_meta(module_id),
|
||||||
|
));
|
||||||
|
(inner_scope, self.2)
|
||||||
}
|
}
|
||||||
ast::BlockLevelStatement::WhileLoop(expression, block) => (
|
ast::BlockLevelStatement::WhileLoop(expression, block) => (
|
||||||
StmtKind::While(WhileStatement {
|
StmtKind::While(WhileStatement {
|
||||||
|
Loading…
Reference in New Issue
Block a user