@@ -89,9 +89,12 @@ pub enum JsChangeType<'alloc: 'data, 'data> {
8989 } ,
9090 /// replace span with ""
9191 Delete ,
92- // ;cfg.cleanrestfn(restids[0]); cfg.cleanrestfn(restid[1]);
93- CleanRest {
92+ // ;cfg.cleanrestfn(restids[0]); cfg.cleanrestfn(restids[1]);
93+ // or
94+ // (cfg.cleanrestfn(restids[0]), cfg.cleanrestfn(restids[1]),
95+ CleanFunction {
9496 restids : Vec < Atom < ' data > > ,
97+ expression : bool ,
9598 } ,
9699}
97100
@@ -156,13 +159,25 @@ impl<'alloc: 'data, 'data> Transform<'data> for JsChange<'alloc, 'data> {
156159 let steps: & ' static str = Box :: leak ( steps. into_boxed_str ( ) ) ;
157160 LL :: insert ( transforms ! [ "((t)=>(" , & steps, "t))(" ] )
158161 }
159- Ty :: CleanRest { restids } => {
160- let mut steps = String :: new ( ) ;
161- for id in restids {
162- steps. push_str ( & format ! ( "{}({});" , & cfg. cleanrestfn, id. as_str( ) ) ) ;
162+ Ty :: CleanFunction {
163+ restids,
164+ expression,
165+ } => {
166+ let mut steps = String :: new ( ) ;
167+
168+ if expression {
169+ for id in restids {
170+ steps. push_str ( & format ! ( "{}({})," , & cfg. cleanrestfn, id. as_str( ) ) ) ;
171+ }
172+ let steps: & ' static str = Box :: leak ( steps. into_boxed_str ( ) ) ;
173+ LL :: insert ( transforms ! [ "(" , & steps] )
174+ } else {
175+ for id in restids {
176+ steps. push_str ( & format ! ( "{}({});" , & cfg. cleanrestfn, id. as_str( ) ) ) ;
177+ }
178+ let steps: & ' static str = Box :: leak ( steps. into_boxed_str ( ) ) ;
179+ LL :: insert ( transforms ! [ ";" , & steps] )
163180 }
164- let steps: & ' static str = Box :: leak ( steps. into_boxed_str ( ) ) ;
165- LL :: insert ( transforms ! [ ";" , & steps] )
166181 }
167182 Ty :: SetRealmFn => LL :: insert ( transforms ! [ & cfg. setrealmfn, "({})." ] ) ,
168183 Ty :: ScramErrFn { ident } => LL :: insert ( transforms ! [ "$scramerr(" , ident, ");" ] ) ,
0 commit comments