Skip to content

Commit

Permalink
Merge branch 'main' into es/typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Aug 7, 2024
2 parents 5bd6bc5 + 679682c commit 6053b23
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
5 changes: 5 additions & 0 deletions crates/swc_ecma_minifier/tests/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11345,3 +11345,8 @@ fn issue_9184_2() {
"#,
);
}

#[test]
fn issue_9356() {
run_default_exec_test("console.log((function ({ } = 42) { }).length)");
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,6 @@ impl VisitMut for Remover {
*p = *assign.left.take();
}

Pat::Assign(assign)
if match *assign.left {
Pat::Object(ref o) => o.props.is_empty(),
_ => false,
} && assign.right.is_number() =>
{
*p = *assign.left.take();
}

_ => {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1452,16 +1452,6 @@ fn test_empty_key_in_object_pattern_removed() {
test_same("const {[foo()]: {}} = {};");
}

#[test]
fn test_empty_key_in_object_pattern_with_default_value_maybe_removed() {
test("const {f: {} = 0} = {};", "");
// In theory the following case could be reduced to `foo()`, but that gets more
// complicated to implement for object patterns with multiple keys with side
// effects. Instead the pass backs off for any default with a possible side
// effect
test_same("const {f: {} = foo()} = {};");
}

#[test]
fn test_empty_key_in_object_pattern_not_removed_with_object_rest() {
test_same("const {f: {}, ...g} = foo()");
Expand Down

0 comments on commit 6053b23

Please sign in to comment.