@@ -639,7 +639,7 @@ private Address getParentAddress(AccountStatus as) {
639
639
*/
640
640
@ SuppressWarnings ("unchecked" )
641
641
public <T extends ACell > T lookupValue (String symName ) {
642
- return (T ) lookupValue (Symbol .create (symName ));
642
+ return (T ) lookupValue (getAddress (), Symbol .create (symName ));
643
643
}
644
644
645
645
/**
@@ -648,17 +648,7 @@ public <T extends ACell> T lookupValue(String symName) {
648
648
* @return Value for the given symbol or null if undeclared
649
649
*/
650
650
public ACell lookupValue (Symbol sym ) {
651
- AHashMap <Symbol , ACell > env =getEnvironment ();
652
-
653
- // Lookup in current environment first
654
- MapEntry <Symbol ,ACell > me =env .getEntry (sym );
655
- if (me !=null ) {
656
- return me .getValue ();
657
- }
658
-
659
- AccountStatus as = getAliasedAccount (env );
660
- if (as ==null ) return null ;
661
- return as .getEnvironment ().get (sym );
651
+ return lookupValue (getAddress (),sym );
662
652
}
663
653
664
654
/**
@@ -668,11 +658,9 @@ public ACell lookupValue(Symbol sym) {
668
658
* @return Value for the given symbol or null if undeclared
669
659
*/
670
660
public ACell lookupValue (Address address ,Symbol sym ) {
671
- if (address ==null ) return lookupValue (sym );
672
- AccountStatus as =getAccountStatus (address );
673
- if (as ==null ) return null ;
674
- AHashMap <Symbol , ACell > env =as .getEnvironment ();
675
- return env .get (sym );
661
+ MapEntry <Symbol ,ACell > entry =lookupDynamicEntry (address ,sym );
662
+ if (entry ==null ) return null ;
663
+ return entry .getValue ();
676
664
}
677
665
678
666
/**
@@ -683,6 +671,7 @@ public ACell lookupValue(Address address,Symbol sym) {
683
671
* @return Environment entry
684
672
*/
685
673
public MapEntry <Symbol ,ACell > lookupDynamicEntry (Address address ,Symbol sym ) {
674
+ if (address ==null ) address =getAddress ();
686
675
AccountStatus as =getAccountStatus (address );
687
676
if (as ==null ) return null ;
688
677
return lookupDynamicEntry (as ,sym );
0 commit comments