@@ -39,6 +39,7 @@ public void setUp() throws Exception {
39
39
setAcceptedLanguage (LanguageMode .ECMASCRIPT_2015 );
40
40
languageOut = LanguageMode .ECMASCRIPT3 ;
41
41
42
+ enableNormalize ();
42
43
enableTypeInfoValidation ();
43
44
enableTypeCheck ();
44
45
replaceTypesWithColors ();
@@ -280,9 +281,9 @@ public void testCapturingThisInArrowFromClassConstructorWithSuperCall() {
280
281
" }" ,
281
282
"}" ,
282
283
"class C extends B {" ,
283
- " constructor(x, y) {" ,
284
+ " constructor(x$jscomp$1 , y) {" ,
284
285
" console.log('statement before super');" ,
285
- " super(x);" ,
286
+ " super(x$jscomp$1 );" ,
286
287
" const $jscomp$this$UID$2 = this;" , // Must not use `this` before super() call.
287
288
" this.wrappedXGetter = function() { return $jscomp$this$UID$2.x; };" ,
288
289
" this.y = y;" ,
@@ -325,11 +326,11 @@ public void testCapturingThisInArrowFromClassConstructorWithMultipleSuperCallPat
325
326
" }" ,
326
327
"}" ,
327
328
"class C extends B {" ,
328
- " constructor(x, y) {" ,
329
- " if (x < 1) {" ,
330
- " super(x);" ,
329
+ " constructor(x$jscomp$1 , y) {" ,
330
+ " if (x$jscomp$1 < 1) {" ,
331
+ " super(x$jscomp$1 );" ,
331
332
" } else {" ,
332
- " super(-x);" ,
333
+ " super(-x$jscomp$1 );" ,
333
334
" }" ,
334
335
" const $jscomp$this$UID$2 = this;" , // Must not use `this` before super() call.
335
336
" this.wrappedXGetter = function() { return $jscomp$this$UID$2.x; };" ,
@@ -343,7 +344,8 @@ public void testCapturingThisInArrowFromClassConstructorWithMultipleSuperCallPat
343
344
public void testMultipleArrowsInSameFreeScope () {
344
345
testArrowRewriting (
345
346
"var a1 = x => x+1; var a2 = x => x-1;" ,
346
- "var a1 = function(x) { return x+1; }; var a2 = function(x) { return x-1; };" );
347
+ "var a1 = function(x) { return x+1; }; var a2 = function(x$jscomp$1) { return x$jscomp$1-1;"
348
+ + " };" );
347
349
}
348
350
349
351
@ Test
@@ -353,7 +355,7 @@ public void testMultipleArrowsInSameFunctionScope() {
353
355
lines (
354
356
"function f() {" ,
355
357
" var a1 = function(x) { return x+1; };" ,
356
- " var a2 = function(x) { return x-1; };" ,
358
+ " var a2 = function(x$jscomp$1 ) { return x$jscomp$1 -1; };" ,
357
359
"}" ));
358
360
}
359
361
@@ -423,7 +425,8 @@ public void testPassingMultipleArrowsInSameFreeScopeAsMethodParams() {
423
425
expected (
424
426
lines (
425
427
"var a = [1,2,3,4];" ,
426
- "var b = a.map(function(x) { return x+1; }).map(function(x) { return x*x; });" )));
428
+ "var b = a.map(function(x) { return x+1; }).map(function(x$jscomp$1) { return"
429
+ + " x$jscomp$1*x$jscomp$1; });" )));
427
430
}
428
431
429
432
@ Test
@@ -448,7 +451,8 @@ public void testMultipleArrowsInSameFunctionScopeAsMethodParams() {
448
451
lines (
449
452
"function f() {" ,
450
453
" var a = [1,2,3,4];" ,
451
- " var b = a.map(function(x) { return x+1; }).map(function(x) { return x*x; });" ,
454
+ " var b = a.map(function(x) { return x+1; }).map(function(x$jscomp$1) { return"
455
+ + " x$jscomp$1*x$jscomp$1; });" ,
452
456
"}" )));
453
457
}
454
458
0 commit comments