datex_core/values/value_container/
to_instructions.rs1use crate::{
2 core_compiler::{
3 to_instructions::ToInstructions, value_visitor::ValueVisitor,
4 },
5 prelude::*,
6 runtime::cache::shared_references_cache::SharedReferencesCache,
7 values::value_container::ValueContainer,
8};
9
10impl ToInstructions for ValueContainer {
11 fn to_instructions<'a>(
12 &'a self,
13 visitor: &'a mut dyn ValueVisitor,
14 cache: &'a mut SharedReferencesCache,
15 ) -> Box<dyn Iterator<Item = crate::instruction::Instruction> + 'a> {
16 match self {
17 ValueContainer::Local(value) => {
18 value.to_instructions(visitor, cache)
19 }
20 ValueContainer::Shared(shared) => {
21 visitor.visit_shared_container(shared, cache)
22 }
23 }
24 }
25}