@@ -13,12 +13,10 @@ use oxc::{
1313use crate :: {
1414 analyzer:: Analyzer ,
1515 ast:: { AstKind2 , DeclarationKind } ,
16- dep:: Dep ,
1716 entity:: Entity ,
18- scope:: VariableScopeId ,
1917 transformer:: Transformer ,
20- utils:: { CalleeInfo , CalleeNode } ,
21- value:: { ArgumentsValue , ObjectPrototype , ValueTrait , cache:: FnCacheTrackingData } ,
18+ utils:: CalleeNode ,
19+ value:: { ObjectPrototype , ValueTrait , cache:: FnCacheTrackingData , call :: FnCallInfo } ,
2220} ;
2321
2422#[ derive( Default ) ]
@@ -54,15 +52,6 @@ impl<'a> Analyzer<'a> {
5452 } ;
5553
5654 // Enter class statics scope
57- let variable_scope = self . scoping . variable . top ( ) ;
58- self . push_call_scope (
59- self . new_callee_info ( CalleeNode :: ClassStatics ( node) ) ,
60- self . factory . no_dep ,
61- variable_scope,
62- false ,
63- false ,
64- false ,
65- ) ;
6655 self . variable_scope_mut ( ) . super_class =
6756 Some ( data. super_class . unwrap_or ( self . factory . undefined ) ) ;
6857
@@ -118,8 +107,6 @@ impl<'a> Analyzer<'a> {
118107 }
119108 }
120109
121- self . pop_call_scope ( ) ;
122-
123110 let class = class. into ( ) ;
124111 data. value = Some ( class) ;
125112 class
@@ -139,23 +126,19 @@ impl<'a> Analyzer<'a> {
139126
140127 pub fn call_class_constructor (
141128 & mut self ,
142- callee : CalleeInfo < ' a > ,
143- call_dep : Dep < ' a > ,
144129 node : & ' a Class < ' a > ,
145- lexical_scope : Option < VariableScopeId > ,
146- this : Entity < ' a > ,
147- args : ArgumentsValue < ' a > ,
148- consume : bool ,
130+ info : FnCallInfo < ' a > ,
149131 ) -> ( Entity < ' a > , FnCacheTrackingData < ' a > ) {
150132 let factory = self . factory ;
151133 let data = self . load_data :: < Data > ( AstKind2 :: Class ( node) ) ;
152134
153- self . push_call_scope ( callee , call_dep , lexical_scope , false , false , consume ) ;
135+ self . push_call_scope ( info , false , false ) ;
154136 let super_class = data. super_class . unwrap_or ( self . factory . undefined ) ;
155- let body_scope = self . variable_scope_mut ( ) ;
156- body_scope. this = Some ( this) ;
157- body_scope. arguments = Some ( ( args, factory. vec ( /* later filled by formal parameters */ ) ) ) ;
158- body_scope. super_class = Some ( super_class) ;
137+ let variable_scope = self . variable_scope_mut ( ) ;
138+ variable_scope. this = Some ( info. this ) ;
139+ variable_scope. arguments =
140+ Some ( ( info. args , factory. vec ( /* later filled by formal parameters */ ) ) ) ;
141+ variable_scope. super_class = Some ( super_class) ;
159142
160143 if let Some ( id) = & node. id {
161144 self . declare_binding_identifier ( id, false , DeclarationKind :: NamedFunctionInBody ) ;
@@ -168,7 +151,7 @@ impl<'a> Analyzer<'a> {
168151 && !node. r#static
169152 {
170153 let value = self . exec_property_definition ( node) ;
171- this. set_property ( self , self . factory . no_dep , key. unwrap ( ) , value) ;
154+ info . this . set_property ( self , self . factory . no_dep , key. unwrap ( ) , value) ;
172155 }
173156 }
174157
@@ -177,15 +160,15 @@ impl<'a> Analyzer<'a> {
177160 let function = constructor. value . as_ref ( ) ;
178161 let dep = self . factory . dep ( AstKind2 :: Function ( function) ) ;
179162 self . cf_scope_mut ( ) . push_dep ( dep) ;
180- self . exec_formal_parameters ( & function. params , args, DeclarationKind :: FunctionParameter ) ;
163+ self . exec_formal_parameters ( & function. params , info . args , DeclarationKind :: FunctionParameter ) ;
181164 self . exec_function_body ( function. body . as_ref ( ) . unwrap ( ) ) ;
182- if consume {
165+ if info . consume {
183166 self . consume_return_values ( ) ;
184167 }
185168 self . pop_call_scope ( )
186169 } else if let Some ( super_class) = & data. super_class {
187170 self . pop_call_scope ( ) ;
188- let ret_val = super_class. call ( self , self . factory . no_dep , this, args) ;
171+ let ret_val = super_class. call ( self , self . factory . no_dep , info . this , info . args ) ;
189172 ( ret_val, FnCacheTrackingData :: worst_case ( ) )
190173 } else {
191174 let ( _, cache_tracking) = self . pop_call_scope ( ) ;
0 commit comments