@@ -645,6 +645,22 @@ impl MainPod {
645645 pub fn id ( & self ) -> PodId {
646646 self . pod . id ( )
647647 }
648+
649+ /// Returns the value of a ValueOf statement with self id that defines key if it exists.
650+ pub fn get ( & self , key : impl Into < Key > ) -> Option < Value > {
651+ let key: Key = key. into ( ) ;
652+ self . public_statements
653+ . iter ( )
654+ . find_map ( |st| match st {
655+ Statement :: ValueOf ( ak, value)
656+ if ak. pod_id == self . id ( ) && ak. key . hash ( ) == key. hash ( ) =>
657+ {
658+ Some ( value)
659+ }
660+ _ => None ,
661+ } )
662+ . cloned ( )
663+ }
648664}
649665
650666struct MainPodCompilerInputs < ' a > {
@@ -759,6 +775,9 @@ pub mod build_utils {
759775 ( new_entry, ( $key: expr, $value: expr) ) => { $crate:: frontend:: Operation (
760776 $crate:: middleware:: OperationType :: Native ( $crate:: middleware:: NativeOperation :: NewEntry ) ,
761777 $crate:: op_args!( ( $key, $value) ) , $crate:: middleware:: OperationAux :: None ) } ;
778+ ( copy, $( $arg: expr) ,+) => { $crate:: frontend:: Operation (
779+ $crate:: middleware:: OperationType :: Native ( $crate:: middleware:: NativeOperation :: CopyStatement ) ,
780+ $crate:: op_args!( $( $arg) ,* ) , $crate:: middleware:: OperationAux :: None ) } ;
762781 ( eq, $( $arg: expr) ,+) => { $crate:: frontend:: Operation (
763782 $crate:: middleware:: OperationType :: Native ( $crate:: middleware:: NativeOperation :: EqualFromEntries ) ,
764783 $crate:: op_args!( $( $arg) ,* ) , $crate:: middleware:: OperationAux :: None ) } ;
0 commit comments