@@ -13,12 +13,12 @@ use swc_common::{
13
13
use swc_ecma_ast:: {
14
14
ArrayPat , ArrowExpr , AutoAccessor , BindingIdent , Class , ClassDecl , ClassMethod , ClassProp ,
15
15
Constructor , Decl , DefaultDecl , DoWhileStmt , EsVersion , ExportAll , ExportDecl ,
16
- ExportDefaultDecl , ExportSpecifier , FnDecl , ForInStmt , ForOfStmt , ForStmt , IfStmt , ImportDecl ,
17
- ImportSpecifier , NamedExport , ObjectPat , Param , Pat , PrivateMethod , PrivateProp , Program , Stmt ,
18
- TsAsExpr , TsConstAssertion , TsEnumDecl , TsExportAssignment , TsImportEqualsDecl ,
19
- TsIndexSignature , TsInstantiation , TsModuleDecl , TsModuleName , TsNamespaceDecl , TsNonNullExpr ,
20
- TsParamPropParam , TsSatisfiesExpr , TsTypeAliasDecl , TsTypeAnn , TsTypeAssertion ,
21
- TsTypeParamDecl , TsTypeParamInstantiation , VarDeclarator , WhileStmt ,
16
+ ExportDefaultDecl , ExportSpecifier , FnDecl , ForInStmt , ForOfStmt , ForStmt , GetterProp , IfStmt ,
17
+ ImportDecl , ImportSpecifier , NamedExport , ObjectPat , Param , Pat , PrivateMethod , PrivateProp ,
18
+ Program , SetterProp , Stmt , TsAsExpr , TsConstAssertion , TsEnumDecl , TsExportAssignment ,
19
+ TsImportEqualsDecl , TsIndexSignature , TsInstantiation , TsModuleDecl , TsModuleName ,
20
+ TsNamespaceDecl , TsNonNullExpr , TsParamPropParam , TsSatisfiesExpr , TsTypeAliasDecl , TsTypeAnn ,
21
+ TsTypeAssertion , TsTypeParamDecl , TsTypeParamInstantiation , VarDeclarator , WhileStmt ,
22
22
} ;
23
23
use swc_ecma_parser:: {
24
24
lexer:: Lexer ,
@@ -1069,6 +1069,34 @@ impl Visit for TsStrip {
1069
1069
self . add_overwrite ( n. body . span_lo ( ) , b';' ) ;
1070
1070
}
1071
1071
}
1072
+
1073
+ fn visit_getter_prop ( & mut self , n : & GetterProp ) {
1074
+ let l_parern_index = self . get_next_token_index ( n. key . span_hi ( ) ) ;
1075
+ let l_parern = & self . tokens [ l_parern_index] ;
1076
+ debug_assert_eq ! ( l_parern. token, Token :: LParen ) ;
1077
+
1078
+ let r_parern_pos = n. type_ann . as_ref ( ) . map_or ( n. body . span_lo ( ) , |t| t. span . lo ) - BytePos ( 1 ) ;
1079
+ let r_parern = self . get_prev_token ( r_parern_pos) ;
1080
+ debug_assert_eq ! ( r_parern. token, Token :: RParen ) ;
1081
+
1082
+ let span = span ( l_parern. span . lo + BytePos ( 1 ) , r_parern. span . hi - BytePos ( 1 ) ) ;
1083
+ self . add_replacement ( span) ;
1084
+
1085
+ n. visit_children_with ( self ) ;
1086
+ }
1087
+
1088
+ fn visit_setter_prop ( & mut self , n : & SetterProp ) {
1089
+ if let Some ( this_param) = & n. this_param {
1090
+ self . add_replacement ( this_param. span ( ) ) ;
1091
+
1092
+ let comma = self . get_prev_token ( n. param . span_lo ( ) - BytePos ( 1 ) ) ;
1093
+ debug_assert_eq ! ( comma. token, Token :: Comma ) ;
1094
+
1095
+ self . add_replacement ( comma. span ) ;
1096
+ }
1097
+
1098
+ n. visit_children_with ( self ) ;
1099
+ }
1072
1100
}
1073
1101
1074
1102
trait IsTsDecl {
0 commit comments