@@ -43,9 +43,11 @@ pub enum JsChangeType<'alloc: 'data, 'data> {
4343 RebindProperty {
4444 ident : Atom < ' data > ,
4545 } ,
46+ TempVar ,
4647
4748 WrapObjectAssignmentLeft {
4849 restids : Vec < Atom < ' data > > ,
50+ location_assigned : bool ,
4951 } ,
5052
5153 /// insert `${cfg.setrealmfn}({}).`
@@ -132,11 +134,15 @@ impl<'alloc: 'data, 'data> Transform<'data> for JsChange<'alloc, 'data> {
132134 Ty :: RebindProperty { ident } => {
133135 LL :: replace ( transforms ! [ & cfg. wrappropertybase, ident, ":" , ident] )
134136 }
135- Ty :: WrapObjectAssignmentLeft { restids } => {
137+ Ty :: TempVar => LL :: replace ( transforms ! [ & cfg. templocid] ) ,
138+ Ty :: WrapObjectAssignmentLeft { restids, location_assigned } => {
136139 let mut steps = String :: new ( ) ;
137140 for id in restids {
138141 steps. push_str ( & format ! ( "{}({})," , & cfg. cleanrestfn, id. as_str( ) ) ) ;
139142 }
143+ if location_assigned {
144+ steps. push_str ( & format ! ( "{}(location,\" =\" ,{})||(location={})," , & cfg. trysetfn, & cfg. templocid, & cfg. templocid) ) ;
145+ }
140146 let steps: & ' static str = Box :: leak ( steps. into_boxed_str ( ) ) ;
141147 LL :: insert ( transforms ! [ "((t)=>(" , & steps, "t))(" ] )
142148 }
@@ -157,7 +163,9 @@ impl<'alloc: 'data, 'data> Transform<'data> for JsChange<'alloc, 'data> {
157163 Ty :: ImportFn => LL :: replace ( transforms ! [ & cfg. importfn, "(\" " , & flags. base, "\" ," ] ) ,
158164 Ty :: MetaFn => LL :: replace ( transforms ! [ & cfg. metafn, "(\" " , & flags. base, "\" )" ] ) ,
159165 Ty :: AssignmentLeft { name, op } => LL :: replace ( transforms ! [
160- "((t)=>$scramjet$tryset(" ,
166+ "((t)=>" ,
167+ & cfg. trysetfn,
168+ "(" ,
161169 name,
162170 ",\" " ,
163171 op,
0 commit comments