use crate::{
core_compiler::value_visitor::ValueVisitor, instruction::Instruction,
prelude::*, runtime::cache::shared_references_cache::SharedReferencesCache,
};
pub trait ToInstructions {
fn to_instructions<'a>(
&'a self,
visitor: &'a mut dyn ValueVisitor,
cache: &'a mut SharedReferencesCache,
) -> Box<dyn Iterator<Item = Instruction> + 'a>;
}
pub macro yield_all($iterator:expr) {
for instruction in $iterator {
yield instruction;
}
}
pub macro yield_all_collected($iter:expr) {{
let collected: Vec<_> = $iter.collect();
for instr in collected {
yield instr;
}
}}
pub macro yield_all_ok($iterator:expr) {
for instruction in $iterator {
yield Ok(instruction.into());
}
}
pub macro yield_all_ok_collected($iter:expr) {{
let collected: Vec<_> = $iter.collect();
for instr in collected {
yield Ok(instr.into());
}
}}