@@ -151,9 +151,9 @@ issue_4487_1: {
151
151
var b = a ( ) ;
152
152
}
153
153
expect: {
154
- function a ( ) {
154
+ var a = function f ( ) {
155
155
var f = console . log ( typeof f ) ;
156
- }
156
+ } ;
157
157
a ( ) ;
158
158
}
159
159
expect_stdout: "undefined"
@@ -175,6 +175,31 @@ issue_4487_2: {
175
175
} ;
176
176
var b = a ( ) ;
177
177
}
178
+ expect: {
179
+ function a ( ) {
180
+ var f = console . log ( typeof f ) ;
181
+ }
182
+ a ( ) ;
183
+ }
184
+ expect_stdout: "undefined"
185
+ }
186
+
187
+ issue_4487_3: {
188
+ options = {
189
+ functions : true ,
190
+ hoist_vars : true ,
191
+ keep_fnames : true ,
192
+ passes : 3 ,
193
+ reduce_vars : true ,
194
+ toplevel : true ,
195
+ unused : true ,
196
+ }
197
+ input: {
198
+ var a = function f ( ) {
199
+ var f = console . log ( typeof f ) ;
200
+ } ;
201
+ var b = a ( ) ;
202
+ }
178
203
expect: {
179
204
( function a ( ) {
180
205
console . log ( typeof void 0 ) ;
@@ -256,9 +281,8 @@ issue_4736: {
256
281
expect: {
257
282
( function ( ) {
258
283
( function ( ) {
259
- var b = 1 << 30 ;
260
284
0 ,
261
- console . log ( b ) ;
285
+ console . log ( 1073741824 ) ;
262
286
} ) ( ) ;
263
287
} ) ( ) ;
264
288
}
@@ -275,18 +299,18 @@ issue_4839: {
275
299
unused : true ,
276
300
}
277
301
input: {
278
- var o = function ( a , b ) {
302
+ var log = console . log , o = function ( a , b ) {
279
303
return b && b ;
280
304
} ( "foo" ) ;
281
305
for ( var k in o )
282
306
throw "FAIL" ;
283
- console . log ( "PASS" ) ;
307
+ log ( "PASS" ) ;
284
308
}
285
309
expect: {
286
- var k , o = void 0 ;
287
- for ( k in o )
310
+ var k , log = console . log ;
311
+ for ( k in void 0 )
288
312
throw "FAIL" ;
289
- console . log ( "PASS" ) ;
313
+ log ( "PASS" ) ;
290
314
}
291
315
expect_stdout: "PASS"
292
316
}
@@ -312,8 +336,7 @@ issue_4859: {
312
336
}
313
337
expect: {
314
338
( function f ( a ) {
315
- var d = 1 / 0 , d = Infinity ;
316
- console . log ( d ) ;
339
+ console . log ( Infinity ) ;
317
340
return f ;
318
341
} ) ( ) ;
319
342
}
@@ -448,3 +471,32 @@ issue_5187: {
448
471
}
449
472
expect_stdout: "42"
450
473
}
474
+
475
+ issue_5195: {
476
+ options = {
477
+ hoist_props : true ,
478
+ hoist_vars : true ,
479
+ reduce_vars : true ,
480
+ side_effects : true ,
481
+ toplevel : true ,
482
+ unused : true ,
483
+ }
484
+ input: {
485
+ function f ( ) {
486
+ var a ;
487
+ do {
488
+ var b = { p : a } ;
489
+ } while ( console . log ( b += "" ) ) ;
490
+ }
491
+ f ( ) ;
492
+ }
493
+ expect: {
494
+ ( function ( ) {
495
+ var a , b ;
496
+ do {
497
+ b = { p : a } ;
498
+ } while ( console . log ( b += "" ) ) ;
499
+ } ) ( ) ;
500
+ }
501
+ expect_stdout: "[object Object]"
502
+ }
0 commit comments