@@ -9,22 +9,17 @@ use oxc_span::Span;
99use crate :: {
1010 ecmascript:: {
1111 execution:: {
12- Agent , Environment , ExecutionContext , JsResult , PrivateEnvironment , ProtoIntrinsics ,
13- agent:: { ExceptionType , TryResult } ,
12+ Agent , Environment , ExecutionContext , JsResult , PrivateEnvironment ,
13+ agent:: ExceptionType ,
1414 } ,
1515 scripts_and_modules:: source_code:: SourceCode ,
1616 syntax_directed_operations:: class_definitions:: {
1717 base_class_default_constructor, derived_class_default_constructor,
1818 } ,
1919 types:: {
2020 BUILTIN_STRING_MEMORY , BuiltinConstructorHeapData , Function ,
21- FunctionInternalProperties , InternalMethods , InternalSlots , IntoFunction , IntoObject ,
22- IntoValue , Object , OrdinaryObject , PropertyDescriptor , PropertyKey , SetResult , String ,
23- TryGetResult , TryHasResult , Value , function_create_backing_object,
24- function_internal_define_own_property, function_internal_delete, function_internal_get,
25- function_internal_get_own_property, function_internal_has_property,
26- function_internal_own_property_keys, function_internal_set, function_try_get,
27- function_try_has_property, function_try_set,
21+ FunctionInternalProperties , IntoFunction , IntoObject , IntoValue , Object ,
22+ OrdinaryObject , PropertyKey , String , Value ,
2823 } ,
2924 } ,
3025 engine:: {
@@ -38,7 +33,7 @@ use crate::{
3833 } ,
3934} ;
4035
41- use super :: { ArgumentsList , ordinary :: caches :: PropertyLookupCache } ;
36+ use super :: ArgumentsList ;
4237
4338#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
4439pub struct BuiltinConstructorFunction < ' a > ( pub ( crate ) BuiltinConstructorIndex < ' a > ) ;
@@ -171,138 +166,18 @@ impl<'a> FunctionInternalProperties<'a> for BuiltinConstructorFunction<'a> {
171166 fn get_length ( self , _: & Agent ) -> u8 {
172167 unreachable ! ( ) ;
173168 }
174- }
175-
176- impl < ' a > InternalSlots < ' a > for BuiltinConstructorFunction < ' a > {
177- const DEFAULT_PROTOTYPE : ProtoIntrinsics = ProtoIntrinsics :: Function ;
178169
179170 #[ inline( always) ]
180- fn get_backing_object ( self , agent : & Agent ) -> Option < OrdinaryObject < ' static > > {
171+ fn get_function_backing_object ( self , agent : & Agent ) -> Option < OrdinaryObject < ' static > > {
181172 agent[ self ] . object_index
182173 }
183174
184- fn set_backing_object ( self , agent : & mut Agent , backing_object : OrdinaryObject < ' static > ) {
185- assert ! ( agent[ self ] . object_index. replace( backing_object) . is_none( ) ) ;
186- }
187-
188- fn create_backing_object ( self , agent : & mut Agent ) -> OrdinaryObject < ' static > {
189- function_create_backing_object ( self , agent)
190- }
191- }
192-
193- impl < ' a > InternalMethods < ' a > for BuiltinConstructorFunction < ' a > {
194- fn try_get_own_property < ' gc > (
195- self ,
196- agent : & mut Agent ,
197- property_key : PropertyKey ,
198- cache : Option < PropertyLookupCache > ,
199- gc : NoGcScope < ' gc , ' _ > ,
200- ) -> TryResult < ' gc , Option < PropertyDescriptor < ' gc > > > {
201- TryResult :: Continue ( function_internal_get_own_property (
202- self ,
203- agent,
204- property_key,
205- cache,
206- gc,
207- ) )
208- }
209-
210- fn try_define_own_property < ' gc > (
211- self ,
212- agent : & mut Agent ,
213- property_key : PropertyKey ,
214- property_descriptor : PropertyDescriptor ,
215- cache : Option < PropertyLookupCache > ,
216- gc : NoGcScope < ' gc , ' _ > ,
217- ) -> TryResult < ' gc , bool > {
218- function_internal_define_own_property (
219- self ,
220- agent,
221- property_key,
222- property_descriptor,
223- cache,
224- gc,
225- )
226- }
227-
228- fn try_has_property < ' gc > (
175+ fn set_function_backing_object (
229176 self ,
230177 agent : & mut Agent ,
231- property_key : PropertyKey ,
232- cache : Option < PropertyLookupCache > ,
233- gc : NoGcScope < ' gc , ' _ > ,
234- ) -> TryResult < ' gc , TryHasResult < ' gc > > {
235- function_try_has_property ( self , agent, property_key, cache, gc)
236- }
237-
238- fn internal_has_property < ' gc > (
239- self ,
240- agent : & mut Agent ,
241- property_key : PropertyKey ,
242- gc : GcScope < ' gc , ' _ > ,
243- ) -> JsResult < ' gc , bool > {
244- function_internal_has_property ( self , agent, property_key, gc)
245- }
246-
247- fn try_get < ' gc > (
248- self ,
249- agent : & mut Agent ,
250- property_key : PropertyKey ,
251- receiver : Value ,
252- cache : Option < PropertyLookupCache > ,
253- gc : NoGcScope < ' gc , ' _ > ,
254- ) -> TryResult < ' gc , TryGetResult < ' gc > > {
255- function_try_get ( self , agent, property_key, receiver, cache, gc)
256- }
257-
258- fn internal_get < ' gc > (
259- self ,
260- agent : & mut Agent ,
261- property_key : PropertyKey ,
262- receiver : Value ,
263- gc : GcScope < ' gc , ' _ > ,
264- ) -> JsResult < ' gc , Value < ' gc > > {
265- function_internal_get ( self , agent, property_key, receiver, gc)
266- }
267-
268- fn try_set < ' gc > (
269- self ,
270- agent : & mut Agent ,
271- property_key : PropertyKey ,
272- value : Value ,
273- receiver : Value ,
274- cache : Option < PropertyLookupCache > ,
275- gc : NoGcScope < ' gc , ' _ > ,
276- ) -> TryResult < ' gc , SetResult < ' gc > > {
277- function_try_set ( self , agent, property_key, value, receiver, cache, gc)
278- }
279-
280- fn internal_set < ' gc > (
281- self ,
282- agent : & mut Agent ,
283- property_key : PropertyKey ,
284- value : Value ,
285- receiver : Value ,
286- gc : GcScope < ' gc , ' _ > ,
287- ) -> JsResult < ' gc , bool > {
288- function_internal_set ( self , agent, property_key, value, receiver, gc)
289- }
290-
291- fn try_delete < ' gc > (
292- self ,
293- agent : & mut Agent ,
294- property_key : PropertyKey ,
295- gc : NoGcScope < ' gc , ' _ > ,
296- ) -> TryResult < ' gc , bool > {
297- TryResult :: Continue ( function_internal_delete ( self , agent, property_key, gc) )
298- }
299-
300- fn try_own_property_keys < ' gc > (
301- self ,
302- agent : & mut Agent ,
303- gc : NoGcScope < ' gc , ' _ > ,
304- ) -> TryResult < ' gc , Vec < PropertyKey < ' gc > > > {
305- TryResult :: Continue ( function_internal_own_property_keys ( self , agent, gc) )
178+ backing_object : OrdinaryObject < ' static > ,
179+ ) {
180+ assert ! ( agent[ self ] . object_index. replace( backing_object) . is_none( ) ) ;
306181 }
307182
308183 /// ### [10.3.1 \[\[Call\]\] ( thisArgument, argumentsList )](https://tc39.es/ecma262/#sec-built-in-function-objects-call-thisargument-argumentslist)
@@ -312,7 +187,7 @@ impl<'a> InternalMethods<'a> for BuiltinConstructorFunction<'a> {
312187 /// (a List of ECMAScript language values) and returns either a normal
313188 /// completion containing an ECMAScript language value or a throw
314189 /// completion.
315- fn internal_call < ' gc > (
190+ fn function_call < ' gc > (
316191 self ,
317192 agent : & mut Agent ,
318193 _: Value ,
@@ -334,7 +209,7 @@ impl<'a> InternalMethods<'a> for BuiltinConstructorFunction<'a> {
334209 /// the method is present) takes arguments argumentsList (a List of
335210 /// ECMAScript language values) and newTarget (a constructor) and returns
336211 /// either a normal completion containing an Object or a throw completion.
337- fn internal_construct < ' gc > (
212+ fn function_construct < ' gc > (
338213 self ,
339214 agent : & mut Agent ,
340215 arguments_list : ArgumentsList ,
0 commit comments