mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 13:38:33 +03:00
fix(es/fixer): Handle more expressions in the super class position (#3452)
This commit is contained in:
parent
479b509845
commit
032f397b52
@ -305,7 +305,15 @@ impl VisitMut for Fixer<'_> {
|
||||
self.ctx = Context::Default;
|
||||
node.visit_mut_children_with(self);
|
||||
match &mut node.super_class {
|
||||
Some(ref mut e) if e.is_seq() || e.is_await_expr() || e.is_bin() => self.wrap(&mut **e),
|
||||
Some(ref mut e)
|
||||
if e.is_seq()
|
||||
|| e.is_await_expr()
|
||||
|| e.is_bin()
|
||||
|| e.is_assign()
|
||||
|| e.is_cond() =>
|
||||
{
|
||||
self.wrap(&mut **e)
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
self.ctx = old;
|
||||
@ -1330,6 +1338,30 @@ var store = global[SHARED] || (global[SHARED] = {});
|
||||
"class MultiVector extends (options.baseType||Float32Array) {}"
|
||||
);
|
||||
|
||||
identical!(
|
||||
extends_nullish_coalescing,
|
||||
"class Foo extends (Bar ?? class{}) {}"
|
||||
);
|
||||
|
||||
identical!(extends_assign, "class Foo extends (Bar = class{}) {}");
|
||||
|
||||
identical!(
|
||||
extends_logical_or_assin,
|
||||
"class Foo extends (Bar ||= class{}) {}"
|
||||
);
|
||||
|
||||
identical!(
|
||||
extends_logical_and_assin,
|
||||
"class Foo extends (Bar &&= class{}) {}"
|
||||
);
|
||||
|
||||
identical!(
|
||||
extends_logical_nullish_assin,
|
||||
"class Foo extends (Bar ??= class{}) {}"
|
||||
);
|
||||
|
||||
identical!(extends_cond, "class Foo extends (true ? Bar : Baz) {}");
|
||||
|
||||
identical!(deno_10668_1, "console.log(null ?? (undefined && true))");
|
||||
|
||||
identical!(deno_10668_2, "console.log(null && (undefined ?? true))");
|
||||
|
Loading…
Reference in New Issue
Block a user