fix(es/decorator): Remove noop_fold_type (#4022)

This commit is contained in:
Donny/강동윤 2022-03-15 18:14:47 +09:00 committed by GitHub
parent 531762ae71
commit 0c8c3d7d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 3 deletions

View File

@ -0,0 +1,23 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true
},
"target": "es2022",
"loose": false,
"transform": {
"legacyDecorator": true,
"decoratorMetadata": false
},
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "es6"
},
"minify": false
}

View File

@ -0,0 +1,2 @@
namespace N { @foo class C1 { } }
@foo class C2 { }

View File

@ -0,0 +1,8 @@
var _class, _class1;
var N;
(function(N) {
let C1 = _class = foo((_class = class C1 {
}) || _class) || _class;
})(N || (N = {}));
let C2 = _class1 = foo((_class1 = class C2 {
}) || _class1) || _class1;

View File

@ -10,7 +10,7 @@ use swc_ecma_utils::{
prop_name_to_expr, prop_name_to_expr_value, quote_ident, replace_ident, undefined, ExprFactory,
ModuleItemLike, StmtLike,
};
use swc_ecma_visit::{noop_fold_type, Fold, FoldWith, Visit, VisitWith};
use swc_ecma_visit::{Fold, FoldWith, Visit, VisitWith};
use self::metadata::{Metadata, ParamMetadata};
use super::{contains_decorator, DecoratorFinder};
@ -86,8 +86,6 @@ impl Visit for Legacy {
/// TODO: VisitMut
impl Fold for Legacy {
noop_fold_type!();
fn fold_decl(&mut self, decl: Decl) -> Decl {
let decl: Decl = decl.fold_children_with(self);