From 3c952d08b179fa3aa0f2445b780c981633545a18 Mon Sep 17 00:00:00 2001 From: suxin2017 Date: Tue, 25 Oct 2022 21:02:39 +0800 Subject: [PATCH 1/2] fix: issue_6219 --- crates/swc_ecma_transforms_typescript/src/strip.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/crates/swc_ecma_transforms_typescript/src/strip.rs b/crates/swc_ecma_transforms_typescript/src/strip.rs index ea8f6d9839de..923290b8ac2c 100644 --- a/crates/swc_ecma_transforms_typescript/src/strip.rs +++ b/crates/swc_ecma_transforms_typescript/src/strip.rs @@ -594,12 +594,6 @@ where if let Some(Some(v)) = values.get(&id.sym) { return Ok(v.clone()); } - // - for m in e.members.iter() { - if &id.sym == m.id.as_ref() { - return compute(e, span, values, None, m.init.as_deref()); - } - } return Err(()); } Expr::Unary(ref expr) => { From dd447165ffab3ff359940eb83018f8d19cd482c2 Mon Sep 17 00:00:00 2001 From: suxin2017 Date: Tue, 25 Oct 2022 21:03:32 +0800 Subject: [PATCH 2/2] chore: add test --- .../swc_ecma_transforms_typescript/tests/strip.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/swc_ecma_transforms_typescript/tests/strip.rs b/crates/swc_ecma_transforms_typescript/tests/strip.rs index eaaa85474441..5078959aea80 100644 --- a/crates/swc_ecma_transforms_typescript/tests/strip.rs +++ b/crates/swc_ecma_transforms_typescript/tests/strip.rs @@ -4655,3 +4655,16 @@ test_with_config!( } " ); + +test!( + ::swc_ecma_parser::Syntax::Typescript(Default::default()), + |_| tr(), + issue_6219, + "enum A{ + a=a, + }", + r#"var A; + (function(A) { + A[A["a"] = a] = "a"; + })(A || (A = {}))"# +);