@@ -21,20 +21,25 @@ pub(crate) enum RewriteType<'alloc: 'data, 'data> {
2121 } ,
2222 /// `cfg.setrealmfn({}).ident`
2323 SetRealmFn ,
24- /// `cfg.wrapthis(this)`
25- WrapThisFn ,
2624
2725 /// `(cfg.importfn("cfg.base"))`
2826 ImportFn ,
2927 /// `cfg.metafn("cfg.base")`
3028 MetaFn ,
3129
3230 /// `window.location` -> cfg.wraplocation(window)
33- WrapAccess {
31+ WrapGet {
3432 ident : Atom < ' data > ,
3533 propspan : Span ,
3634 enclose : bool ,
3735 } ,
36+ /// `window.location` -> cfg.wraplocation(window)
37+ WrapSet {
38+ ident : Atom < ' data > ,
39+ propspan : Span ,
40+ leftspan : Span ,
41+ rightspan : Span ,
42+ } ,
3843 // dead code only if debug is disabled
3944 #[ allow( dead_code) ]
4045 /// `$scramerr(name)`
@@ -104,31 +109,36 @@ impl<'alloc: 'data, 'data> RewriteType<'alloc, 'data> {
104109 change!( span!( start) , WrapFnLeft { enclose } ) ,
105110 change!( span!( end) , WrapFnRight { enclose } ) ,
106111 ] ,
107- Self :: WrapAccess {
112+ Self :: WrapGet {
108113 ident,
109114 propspan,
110115 enclose,
111116 } => smallvec ! [
112- change!( span!( start) , WrapAccessLeft {
117+ change!( span!( start) , WrapGetLeft {
113118 ident,
114119 enclose,
115120 } ) ,
116121 change!( propspan, Delete ) ,
117- change!( span!( end) , WrapAccessRight {
122+ change!( span!( end) , WrapGetRight {
118123 enclose,
119124 } ) ,
120125 ] ,
121- Self :: SetRealmFn => smallvec ! [ change!( span, SetRealmFn ) ] ,
122- Self :: WrapThisFn => smallvec ! [
123- change!( span!( start) , WrapThisFn ) ,
124- change!(
126+ Self :: WrapSet { ident, propspan, leftspan, rightspan } => smallvec ! [
127+ change!( span!( start) , WrapSet {
128+ ident,
129+ propspan,
130+ } ) ,
131+ change!( propspan, Delete ) ,
132+ change!( Span :: new( leftspan. end, rightspan. start) , Replace { text: "," } ) ,
133+ change!(
125134 span!( end) ,
126135 ClosingParen {
127136 semi: false ,
128- replace: false
137+ replace: true
129138 }
130- ) ,
131- ] ,
139+ )
140+ ] ,
141+ Self :: SetRealmFn => smallvec ! [ change!( span, SetRealmFn ) ] ,
132142 Self :: ImportFn => smallvec ! [ change!( span, ImportFn ) ] ,
133143 Self :: MetaFn => smallvec ! [ change!( span, MetaFn ) ] ,
134144 Self :: ScramErr { ident } => smallvec ! [ change!( span!( end) , ScramErrFn { ident } ) ] ,
0 commit comments