Skip to content

Commit 2cc7028

Browse files
authoredJul 12, 2024··
fix(es/compat): Add support for destructuring with BigInts (#9215)
**Related issue:** - #9213
1 parent 524cab0 commit 2cc7028

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"jsc": {
3+
"target": "es5"
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var { 9007199254740991n: it } = { 9007199254740991n: 1 };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var _ref = {
2+
9007199254740991n: 1
3+
}, it = _ref[9007199254740991n];

‎crates/swc_ecma_compat_es2015/src/destructuring.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ fn make_ref_ident_for_array(
12051205
}
12061206

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

12101210
MemberExpr {
12111211
span: DUMMY_SP,

0 commit comments

Comments
 (0)
Please sign in to comment.