Skip to content

Commit b3cc3b8

Browse files
committed
[core][rewriter] dpsc: handle the comma operator correctly in wrapped properties
1 parent 19ad307 commit b3cc3b8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rewriter/js/src/changes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub enum JsChangeType<'alloc: 'data, 'data> {
3636
},
3737

3838
WrapPropertyLeft,
39+
WrapPropertyRight,
3940
RewriteProperty {
4041
ident: Atom<'data>,
4142
},
@@ -119,7 +120,8 @@ impl<'alloc: 'data, 'data> Transform<'data> for JsChange<'alloc, 'data> {
119120
} else {
120121
transforms![")"]
121122
}),
122-
Ty::WrapPropertyLeft => LL::insert(transforms![&cfg.wrappropertyfn, "("]),
123+
Ty::WrapPropertyLeft => LL::insert(transforms![&cfg.wrappropertyfn, "(("]),
124+
Ty::WrapPropertyRight => LL::insert(transforms!["))"]),
123125
Ty::RewriteProperty { ident } => LL::replace(transforms![&cfg.wrappropertybase,ident]),
124126

125127
Ty::SetRealmFn => LL::insert(transforms![&cfg.setrealmfn, "({})."]),

rewriter/js/src/rewrite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'alloc: 'data, 'data> RewriteType<'alloc, 'data> {
112112
],
113113
Self::WrapProperty => smallvec![
114114
change!(span!(start), WrapPropertyLeft),
115-
change!(span!(end), ClosingParen { semi: false, replace: false }),
115+
change!(span!(end), WrapPropertyRight),
116116
],
117117
Self::SetRealmFn => smallvec![change!(span, SetRealmFn)],
118118
Self::ImportFn => smallvec![change!(span, ImportFn)],

0 commit comments

Comments
 (0)