Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Nov 19, 2022
1 parent 952af6e commit 9f328a3
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions crates/swc_ecma_utils/src/lib.rs
Expand Up @@ -1376,31 +1376,30 @@ pub trait ExprExt {
}
Expr::Object(obj) => {
let can_have_side_effect = |prop: &PropOrSpread| match prop {
PropOrSpread::Spread(_) | PropOrSpread::Prop(prop) => {
match prop.as_ref() {
Prop::Getter(_)
| Prop::Setter(_)
| Prop::Method(_)
| Prop::Shorthand(Ident {
sym: js_word!("__proto__"),
..
})
| Prop::KeyValue(KeyValueProp {
key:
PropName::Ident(Ident {
sym: js_word!("__proto__"),
..
})
| PropName::Str(Str {
value: js_word!("__proto__"),
..
})
| PropName::Computed(_),
..
}) => true,
_ => false,
}
}
PropOrSpread::Spread(_)
| PropOrSpread::Prop(
Prop::Getter(_)
| Prop::Setter(_)
| Prop::Method(_)
| Prop::Shorthand(Ident {
sym: js_word!("__proto__"),
..
})
| Prop::KeyValue(KeyValueProp {
key:
PropName::Ident(Ident {
sym: js_word!("__proto__"),
..
})
| PropName::Str(Str {
value: js_word!("__proto__"),
..
})
| PropName::Computed(_),
..
}),
) => true,
_ => false,
};
if obj.props.iter().any(can_have_side_effect) {
return true;
Expand Down

0 comments on commit 9f328a3

Please sign in to comment.