@@ -707,11 +707,17 @@ impl Interpreter {
707
707
Opcode :: DataRegion => todo ! ( ) ,
708
708
Opcode :: Local ( local) => {
709
709
let local = context. locals [ local as usize ] . clone ( ) ;
710
- context. last_op ( ) ?. arguments . push ( Argument :: Object ( Arc :: new ( Object :: Reference ( local) ) ) ) ;
710
+ context. last_op ( ) ?. arguments . push ( Argument :: Object ( Arc :: new ( Object :: Reference {
711
+ kind : ReferenceKind :: LocalOrArg ,
712
+ inner : local,
713
+ } ) ) ) ;
711
714
}
712
715
Opcode :: Arg ( arg) => {
713
716
let arg = context. args [ arg as usize ] . clone ( ) ;
714
- context. last_op ( ) ?. arguments . push ( Argument :: Object ( Arc :: new ( Object :: Reference ( arg) ) ) ) ;
717
+ context. last_op ( ) ?. arguments . push ( Argument :: Object ( Arc :: new ( Object :: Reference {
718
+ kind : ReferenceKind :: LocalOrArg ,
719
+ inner : arg,
720
+ } ) ) ) ;
715
721
}
716
722
Opcode :: Store => context. start_in_flight_op ( OpInFlight :: new ( Opcode :: Store , 2 ) ) ,
717
723
Opcode :: RefOf => todo ! ( ) ,
@@ -725,15 +731,28 @@ impl Interpreter {
725
731
context. current_block . pc -= 1 ;
726
732
let name = context. namestring ( ) ?;
727
733
728
- let ( _, object) = self . namespace . lock ( ) . search ( & name, & context. current_scope ) ?;
729
- if let Object :: Method { flags, .. } = * object {
730
- context. start_in_flight_op ( OpInFlight :: new_with (
731
- Opcode :: InternalMethodCall ,
732
- flags. arg_count ( ) ,
733
- ) )
734
- } else {
735
- context. last_op ( ) ?. arguments . push ( Argument :: Object ( object) ) ;
734
+ match self . namespace . lock ( ) . search ( & name, & context. current_scope ) {
735
+ Ok ( ( resolved_name, object) ) => {
736
+ if let Object :: Method { flags, .. } = * object {
737
+ context. start_in_flight_op ( OpInFlight :: new_with (
738
+ Opcode :: InternalMethodCall ,
736
739
vec ! [ Argument :: Object ( object) , Argument :: Namestring ( resolved_name) ] ,
740
+ flags. arg_count ( ) ,
741
+ ) )
742
+ } else {
743
+ context. last_op ( ) ?. arguments . push ( Argument :: Object ( object) ) ;
744
+ }
745
+ }
746
+ Err ( AmlError :: ObjectDoesNotExist ( _) ) => {
747
+ if context. current_block . kind == BlockKind :: Package {
748
+ let reference = Object :: Reference {
749
+ kind : ReferenceKind :: Unresolved ,
750
+ inner : Arc :: new ( Object :: String ( name. to_string ( ) ) ) ,
751
+ } ;
752
+ context. last_op ( ) ?. arguments . push ( Argument :: Object ( Arc :: new ( reference) ) ) ;
753
+ }
754
+ }
755
+ Err ( other) => Err ( other) ?,
737
756
}
738
757
}
739
758
@@ -946,6 +965,7 @@ impl Interpreter {
946
965
// TODO: convert object to be of the type of destination, in line with 19.3.5 of the spec
947
966
// TODO: write the object to the destination, including e.g. field writes that then lead to
948
967
// literally god knows what.
968
+ let object = object. unwrap_transparent_reference ( ) ;
949
969
match target {
950
970
Argument :: Object ( target) => match target. gain_mut ( ) {
951
971
Object :: Integer ( target) => match object. gain_mut ( ) {
0 commit comments