Skip to content
Snippets Groups Projects

Conditional schedules

Merged Aaron Councilman requested to merge conditional-schedules into main
5 files
+ 59
0
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -275,6 +275,35 @@ fn compile_stmt(
limit,
}])
}
parser::Stmt::IfThenElse {
span: _,
cond,
thn,
els,
} => {
let cond = compile_exp_as_expr(cond, lexer, macrostab, macros)?;
macros.open_scope();
let thn = ir::ScheduleStmt::Block {
body: compile_ops_as_block(*thn, lexer, macrostab, macros)?,
};
macros.close_scope();
macros.open_scope();
let els = match els {
Some(els) => ir::ScheduleStmt::Block {
body: compile_ops_as_block(*els, lexer, macrostab, macros)?,
},
None => ir::ScheduleStmt::Block { body: vec![] },
};
macros.close_scope();
Ok(vec![ir::ScheduleStmt::IfThenElse {
cond,
thn: Box::new(thn),
els: Box::new(els),
}])
}
parser::Stmt::MacroDecl { span: _, def } => {
let parser::MacroDecl {
name,
Loading