File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -690,6 +690,7 @@ impl Gen for Function<'_> {
690690 let n = p. code_len ( ) ;
691691 let wrap = self . is_expression ( )
692692 && ( ( p. start_of_stmt == n || p. start_of_default_export == n) || self . pife ) ;
693+ let ctx = ctx. and_forbid_call ( false ) ;
693694 p. wrap ( wrap, |p| {
694695 p. print_space_before_identifier ( ) ;
695696 p. add_source_mapping ( self . span ) ;
@@ -2263,6 +2264,7 @@ impl Gen for Class<'_> {
22632264 fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
22642265 let n = p. code_len ( ) ;
22652266 let wrap = self . is_expression ( ) && ( p. start_of_stmt == n || p. start_of_default_export == n) ;
2267+ let ctx = ctx. and_forbid_call ( false ) ;
22662268 p. wrap ( wrap, |p| {
22672269 p. enter_class ( ) ;
22682270 p. print_decorators ( & self . decorators , ctx) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ fn export_type() {
4242fn expr ( ) {
4343 test ( "new (foo()).bar();" , "new (foo()).bar();\n " ) ;
4444 test_minify ( "x in new Error()" , "x in new Error;" ) ;
45+ test (
46+ "new function() { let a = foo?.bar().baz; return a; }();" ,
47+ "new function() {\n \t let a = foo?.bar().baz;\n \t return a;\n }();\n " ,
48+ ) ;
49+ test (
50+ "new class { foo() { let a = foo?.bar().baz; return a; } }();" ,
51+ "new class {\n \t foo() {\n \t \t let a = foo?.bar().baz;\n \t \t return a;\n \t }\n }();\n " ,
52+ ) ;
4553
4654 test ( "1000000000000000128.0.toFixed(0)" , "0xde0b6b3a7640080.toFixed(0);\n " ) ;
4755 test_minify ( "1000000000000000128.0.toFixed(0)" , "0xde0b6b3a7640080.toFixed(0);" ) ;
You can’t perform that action at this time.
0 commit comments