File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -3759,7 +3759,10 @@ Compressor.prototype.compress = function(node) {
3759
3759
if (!in_lambda) return false;
3760
3760
if (!(ab instanceof AST_Return)) return false;
3761
3761
var value = ab.value;
3762
- if (value && !is_undefined(value.tail_node())) return false;
3762
+ if (value) {
3763
+ if (!drop_return_void) return false;
3764
+ if (!is_undefined(value.tail_node())) return false;
3765
+ }
3763
3766
if (!(self instanceof AST_SwitchBranch)) return true;
3764
3767
if (!jump) return false;
3765
3768
if (jump instanceof AST_Exit && jump.value) return false;
Original file line number Diff line number Diff line change @@ -2169,3 +2169,41 @@ issue_5749_2: {
2169
2169
expect_stdout: "PASS"
2170
2170
node_version: ">=4"
2171
2171
}
2172
+
2173
+ issue_5754: {
2174
+ options = {
2175
+ if_return : true ,
2176
+ }
2177
+ input: {
2178
+ async function * f ( a , b ) {
2179
+ try {
2180
+ if ( a )
2181
+ return void 0 ;
2182
+ } finally {
2183
+ console . log ( b ) ;
2184
+ }
2185
+ }
2186
+ f ( 42 , "foo" ) . next ( ) ;
2187
+ f ( null , "bar" ) . next ( ) ;
2188
+ console . log ( "baz" ) ;
2189
+ }
2190
+ expect: {
2191
+ async function * f ( a , b ) {
2192
+ try {
2193
+ if ( a )
2194
+ return void 0 ;
2195
+ } finally {
2196
+ console . log ( b ) ;
2197
+ }
2198
+ }
2199
+ f ( 42 , "foo" ) . next ( ) ;
2200
+ f ( null , "bar" ) . next ( ) ;
2201
+ console . log ( "baz" ) ;
2202
+ }
2203
+ expect_stdout: [
2204
+ "bar" ,
2205
+ "baz" ,
2206
+ "foo" ,
2207
+ ]
2208
+ node_version: ">=10"
2209
+ }
You can’t perform that action at this time.
0 commit comments