@@ -571,7 +571,7 @@ mod handlers {
571571 use std:: ops:: { Add , ControlFlow , Div , Mul , Rem , Sub } ;
572572 use std:: rc:: Rc ;
573573
574- use crate :: frame:: { FrameState , This , TryBlock } ;
574+ use crate :: frame:: { FrameState , TryBlock } ;
575575 use crate :: throw;
576576 use crate :: util:: unlikely;
577577 use crate :: value:: array:: table:: ArrayTable ;
@@ -582,7 +582,7 @@ mod handlers {
582582 use crate :: value:: function:: generator:: GeneratorFunction ;
583583 use crate :: value:: function:: user:: UserFunction ;
584584 use crate :: value:: function:: { Function , FunctionKind , adjust_stack_from_flat_call, this_for_new_target} ;
585- use crate :: value:: object:: { Object , OrdObject , PropertyValue , PropertyValueKind } ;
585+ use crate :: value:: object:: { Object , OrdObject , PropertyValue , PropertyValueKind , This , ThisKind } ;
586586 use crate :: value:: ops:: conversions:: ValueConversion ;
587587 use crate :: value:: ops:: equality;
588588 use crate :: value:: primitive:: Number ;
@@ -930,7 +930,7 @@ mod handlers {
930930
931931 let value = match cx. global . clone ( ) . extract :: < OrdObject > ( & cx. scope ) {
932932 Some ( value) => match value. get_own_property_descriptor ( name. to_key ( & mut cx. scope ) , & mut cx. scope ) ? {
933- Some ( value) => value. kind ( ) . get_or_apply ( & mut cx, This :: Default ) ?,
933+ Some ( value) => value. kind ( ) . get_or_apply ( & mut cx, This :: default ( ) ) ?,
934934 None => {
935935 let name = name. res ( & cx. scope ) . to_owned ( ) ;
936936 throw ! ( & mut cx, ReferenceError , "{} is not defined" , name)
@@ -1062,7 +1062,7 @@ mod handlers {
10621062 throw ! ( cx. scope, TypeError , "supertype constructor must be an object" )
10631063 } ;
10641064
1065- This :: BeforeSuper { super_constructor }
1065+ This :: before_super ( super_constructor)
10661066 } else {
10671067 this_for_new_target ( & mut cx. scope , callee) ?
10681068 } ;
@@ -1076,7 +1076,7 @@ mod handlers {
10761076 throw ! ( cx. scope, TypeError , "supertype constructor must be an object" )
10771077 } ;
10781078
1079- This :: BeforeSuper { super_constructor }
1079+ This :: before_super ( super_constructor)
10801080 } else {
10811081 let new_target = cx. active_frame ( ) . new_target ( ) . unwrap ( ) ;
10821082 this_for_new_target ( & mut cx. scope , new_target) ?
@@ -1207,23 +1207,23 @@ mod handlers {
12071207
12081208 let stack_len = cx. stack . len ( ) ;
12091209 let ( callee, this) = if function_call_kind == FunctionCallKind :: Super {
1210- let callee = match cx. active_frame ( ) . this {
1211- This :: BeforeSuper { super_constructor } => Value :: object ( super_constructor) ,
1210+ let callee = match cx. active_frame ( ) . this . kind ( ) {
1211+ ThisKind :: BeforeSuper { super_constructor } => Value :: object ( super_constructor) ,
12121212 _ => throw ! (
12131213 cx. scope,
12141214 TypeError ,
12151215 "super() must be called exactly once in a subclass constructor"
12161216 ) ,
12171217 } ;
1218- ( callee, This :: Default )
1218+ ( callee, This :: default ( ) )
12191219 } else if has_this {
12201220 cx. stack [ stack_len - argc - 2 ..] . rotate_left ( 2 ) ;
12211221 let ( this, callee) = cx. pop_stack2_rooted ( ) ;
1222- ( callee, This :: Bound ( this) )
1222+ ( callee, This :: bound ( this) )
12231223 } else {
12241224 cx. stack [ stack_len - argc - 1 ..] . rotate_left ( 1 ) ;
12251225 let callee = cx. pop_stack_rooted ( ) ;
1226- ( callee, This :: Default )
1226+ ( callee, This :: default ( ) )
12271227 } ;
12281228
12291229 if let Some ( function) = callee. unpack ( ) . downcast_ref :: < Function > ( & cx. scope ) {
@@ -2050,7 +2050,7 @@ mod handlers {
20502050
20512051 pub fn bindthis ( mut cx : DispatchContext < ' _ > ) -> Result < Option < HandleResult > , Unrooted > {
20522052 let value = cx. pop_stack_rooted ( ) ;
2053- cx. active_frame_mut ( ) . this = This :: Bound ( value) ;
2053+ cx. active_frame_mut ( ) . this = This :: bound ( value) ;
20542054 Ok ( None )
20552055 }
20562056
@@ -2085,7 +2085,7 @@ mod handlers {
20852085 let iterable = value
20862086 . get_property ( symbol_iterator. to_key ( & mut cx. scope ) , & mut cx. scope ) ?
20872087 . root ( & mut cx. scope ) ;
2088- let iterator = iterable. apply ( This :: Bound ( value) , CallArgs :: empty ( ) , & mut cx. scope ) ?;
2088+ let iterator = iterable. apply ( This :: bound ( value) , CallArgs :: empty ( ) , & mut cx. scope ) ?;
20892089 cx. push_stack ( iterator) ;
20902090 Ok ( None )
20912091 }
@@ -2335,12 +2335,12 @@ mod handlers {
23352335 let fun = k
23362336 . get_property( $v. to_key( & mut cx. scope) , & mut cx. scope) ?
23372337 . root( & mut cx. scope) ;
2338- let result = fun. apply( This :: Default , args, & mut cx. scope) ?;
2338+ let result = fun. apply( This :: default ( ) , args, & mut cx. scope) ?;
23392339 cx. push_stack( result) ;
23402340 } else {
23412341 // Fastpath: call builtin directly
23422342 // TODO: should we add to externals?
2343- let result = fun. apply( This :: Default , args, & mut cx. scope) ?;
2343+ let result = fun. apply( This :: default ( ) , args, & mut cx. scope) ?;
23442344 cx. push_stack( result) ;
23452345 }
23462346 } } ;
0 commit comments