Skip to content

Commit

Permalink
fix(es/compat): Add support for destructuring with BigInts (#9215)
Browse files Browse the repository at this point in the history
**Related issue:**

- #9213
  • Loading branch information
magic-akari authored Jul 12, 2024
1 parent 524cab0 commit 2cc7028
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9213/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jsc": {
"target": "es5"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var { 9007199254740991n: it } = { 9007199254740991n: 1 };
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var _ref = {
9007199254740991n: 1
}, it = _ref[9007199254740991n];
2 changes: 1 addition & 1 deletion crates/swc_ecma_compat_es2015/src/destructuring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ fn make_ref_ident_for_array(
}

fn make_ref_prop_expr(ref_ident: &Ident, prop: Box<Expr>, mut computed: bool) -> Expr {
computed |= matches!(*prop, Expr::Lit(Lit::Num(..)) | Expr::Lit(Lit::Str(..)));
computed |= !matches!(*prop, Expr::Ident(..));

MemberExpr {
span: DUMMY_SP,
Expand Down

0 comments on commit 2cc7028

Please sign in to comment.