fix(es/compat): Set inserted var inside export class in destructing (#8470)

This commit is contained in:
Austaras 2024-01-02 10:09:13 +08:00 committed by GitHub
parent ae659616e6
commit 4416077f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View File

@ -565,6 +565,24 @@ impl VisitMut for AssignFolder {
self.exporting = exporting;
}
fn visit_mut_class(&mut self, f: &mut Class) {
let exporting = mem::replace(&mut self.exporting, false);
f.visit_mut_children_with(self);
self.exporting = exporting;
}
fn visit_mut_object_lit(&mut self, f: &mut ObjectLit) {
let exporting = mem::replace(&mut self.exporting, false);
f.visit_mut_children_with(self);
self.exporting = exporting;
}
fn visit_mut_arrow_expr(&mut self, f: &mut ArrowExpr) {
let exporting = mem::replace(&mut self.exporting, false);
f.visit_mut_children_with(self);
self.exporting = exporting;
}
fn visit_mut_expr(&mut self, expr: &mut Expr) {
let ignore_return_value = self.ignore_return_value.take().is_some();

View File

@ -0,0 +1,3 @@
export class A {
constructor(t, { a, b = 6, c } = {}) {}
}

View File

@ -0,0 +1,5 @@
export class A {
constructor(t, ref){
let _ref = ref === void 0 ? {} : ref, a = _ref.a, _ref_b = _ref.b, b = _ref_b === void 0 ? 6 : _ref_b, c = _ref.c;
}
}