@@ -1673,37 +1673,44 @@ impl Compiler {
16731673 ) )
16741674 }
16751675 }
1676- fn find_name ( & self , name : & str , skip_local : bool ) -> Option < LocalName > {
1677- self . find_name_impl ( name, skip_local , false )
1676+ fn find_name ( & self , name : & str , skip_temp : bool ) -> Option < LocalName > {
1677+ self . find_name_impl ( name, skip_temp , false )
16781678 }
16791679 fn find_name_impl (
16801680 & self ,
16811681 name : & str ,
1682- skip_local : bool ,
1682+ skip_temp : bool ,
16831683 stop_at_binding : bool ,
16841684 ) -> Option < LocalName > {
1685- if !skip_local {
1686- if let Some ( local) = self . scope . names . get ( name) . copied ( ) {
1687- return Some ( local) ;
1688- }
1689- }
1685+ // println!("name: {name:?}, skip_temp: {skip_temp}");
1686+ // for scope in self.scopes() {
1687+ // println!(" {:?} {:?}", scope.kind, scope.names);
1688+ // }
16901689 let mut hit_file = false ;
1691- for scope in self . higher_scopes . iter ( ) . rev ( ) {
1690+ let mut hit_temp = false ;
1691+ for scope in self . scopes ( ) {
16921692 if matches ! ( scope. kind, ScopeKind :: File ( _) )
16931693 || stop_at_binding && matches ! ( scope. kind, ScopeKind :: Binding )
16941694 {
16951695 if hit_file {
16961696 break ;
16971697 }
16981698 hit_file = true ;
1699+ } else if matches ! ( scope. kind, ScopeKind :: Temp ( _) ) {
1700+ if skip_temp && !hit_temp {
1701+ hit_temp = true ;
1702+ continue ;
1703+ }
1704+ } else if skip_temp && !hit_temp {
1705+ continue ;
16991706 }
17001707 if let Some ( local) = scope. names . get ( name) . copied ( ) {
17011708 return Some ( local) ;
17021709 }
17031710 }
17041711 // Attempt to look up the identifier as a non-macro
17051712 let as_non_macro =
1706- self . find_name_impl ( name. strip_suffix ( '!' ) ?, skip_local , stop_at_binding) ?;
1713+ self . find_name_impl ( name. strip_suffix ( '!' ) ?, skip_temp , stop_at_binding) ?;
17071714 if let BindingKind :: Module ( _) | BindingKind :: Import ( _) =
17081715 self . asm . bindings [ as_non_macro. index ] . kind
17091716 {
0 commit comments