From 95e7f4d4e91d967c3482dd673a670d134e9760b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 17 Nov 2021 14:53:46 +0900 Subject: [PATCH] fix: Revert #2766 (#2774) --- .../src/es2017/async_to_generator.rs | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs b/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs index 0b6b8e28fad5..b65b2d7a8aaf 100644 --- a/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs +++ b/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs @@ -1,5 +1,5 @@ use std::{iter, mem::replace}; -use swc_common::{util::take::Take, BytePos, Mark, Span, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{util::take::Take, Mark, Span, Spanned, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::{helper, perf::Check}; use swc_ecma_transforms_macros::fast_path; @@ -429,28 +429,9 @@ impl VisitMut for Actual { }) }; - let func_span_lo = { - let key_span_lo = match &prop.key { - PropName::Ident(ident) => ident.span().lo(), - PropName::Str(str) => str.span().lo(), - PropName::Num(num) => num.span().lo(), - PropName::Computed(computed) => computed.span().lo(), - PropName::BigInt(bigint) => bigint.span().lo(), - }; - - // sub length of "async " from prop's key span - key_span_lo - BytePos(6) - }; - - let func_span = Span::new( - func_span_lo, - func_span_lo + BytePos(1), // dummy pos - SyntaxContext::empty(), - ); - prop.function = Function { params: original_fn_params, - span: func_span, + span: prop_method_span, is_async: false, is_generator: false, body: Some(BlockStmt {