Sitelet https://github.com/angular/angular/commit/123bff7
Skip to content

Commit 123bff7

Browse files
petebacondarwinmhevery
authored andcommitted
fix(compiler-cli): generate let statements in ES2015+ mode (#38775)
When the target of the compiler is ES2015 or newer then we should be generating `let` and `const` variable declarations rather than `var`. PR Close #38775
1 parent 6158dc1 commit 123bff7

7 files changed

Lines changed: 48 additions & 44 deletions

File tree

‎packages/compiler-cli/ngcc/test/rendering/esm_rendering_formatter_spec.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ B.decorators = [
6969
{ type: OtherB },
7070
{ type: Directive, args: [{ selector: '[b]' }] }
7171
];
72-
var C_1;
72+
let C_1;
7373
let C = C_1 = class C {};
7474
C.decorators = [
7575
{ type: Directive, args: [{ selector: '[c]' }] },
@@ -111,7 +111,7 @@ B.decorators = [
111111
];
112112
return B;
113113
})();
114-
var C_1;
114+
let C_1;
115115
let C = C_1 = /** @class */ (() => {
116116
class C {}
117117
C.decorators = [
@@ -432,7 +432,7 @@ A.decorators = [
432432
name: _('/node_modules/test-package/some/file.js'),
433433
contents: `
434434
import * as tslib_1 from "tslib";
435-
var D_1;
435+
let D_1;
436436
/* A copyright notice */
437437
import { Directive } from '@angular/core';
438438
const OtherA = () => (node) => { };
@@ -681,9 +681,9 @@ export { D };
681681
const stmt3 = new DeclareVarStmt('baz', new LiteralExpr('qux'), undefined, []);
682682

683683
expect(renderer.printStatement(stmt1, sourceFile, importManager)).toBe('const foo = 42;');
684-
expect(renderer.printStatement(stmt2, sourceFile, importManager)).toBe('var bar = true;');
684+
expect(renderer.printStatement(stmt2, sourceFile, importManager)).toBe('let bar = true;');
685685
expect(renderer.printStatement(stmt3, sourceFile, importManager))
686-
.toBe('var baz = "qux";');
686+
.toBe('let baz = "qux";');
687687
});
688688
});
689689
});

‎packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {getRootFiles, makeTestEntryPointBundle} from '../helpers/utils';
3232
class TestRenderingFormatter implements RenderingFormatter {
3333
private printer = ts.createPrinter({newLine: ts.NewLineKind.LineFeed});
3434

35+
constructor(private isEs5: boolean) {}
36+
3537
addImports(output: MagicString, imports: Import[], sf: ts.SourceFile) {
3638
output.prepend('\n// ADD IMPORTS\n');
3739
}
@@ -63,7 +65,8 @@ class TestRenderingFormatter implements RenderingFormatter {
6365
}
6466
printStatement(stmt: Statement, sourceFile: ts.SourceFile, importManager: ImportManager): string {
6567
const node = translateStatement(
66-
stmt, importManager, NOOP_DEFAULT_IMPORT_RECORDER, ts.ScriptTarget.ES2015);
68+
stmt, importManager, NOOP_DEFAULT_IMPORT_RECORDER,
69+
this.isEs5 ? ts.ScriptTarget.ES5 : ts.ScriptTarget.ES2015);
6770
const code = this.printer.printNode(ts.EmitHint.Unspecified, node, sourceFile);
6871

6972
return `// TRANSPILED\n${code}`;
@@ -94,7 +97,7 @@ function createTestRenderer(
9497
.analyzeProgram(bundle.src.program);
9598
const privateDeclarationsAnalyses =
9699
new PrivateDeclarationsAnalyzer(host, referencesRegistry).analyzeProgram(bundle.src.program);
97-
const testFormatter = new TestRenderingFormatter();
100+
const testFormatter = new TestRenderingFormatter(isEs5);
98101
spyOn(testFormatter, 'addExports').and.callThrough();
99102
spyOn(testFormatter, 'addImports').and.callThrough();
100103
spyOn(testFormatter, 'addDefinitions').and.callThrough();
@@ -569,7 +572,7 @@ UndecoratedBase.ɵfac = function UndecoratedBase_Factory(t) { return new (t || U
569572
UndecoratedBase.ɵdir = ɵngcc0.ɵɵdefineDirective({ type: UndecoratedBase, viewQuery: function UndecoratedBase_Query(rf, ctx) { if (rf & 1) {
570573
ɵngcc0.ɵɵstaticViewQuery(_c0, true);
571574
} if (rf & 2) {
572-
var _t;
575+
let _t;
573576
ɵngcc0.ɵɵqueryRefresh(_t = ɵngcc0.ɵɵloadQuery()) && (ctx.test = _t.first);
574577
} } });`);
575578
});

‎packages/compiler-cli/src/ngtsc/translator/src/translator.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,16 @@ class ExpressionTranslatorVisitor implements ExpressionVisitor, StatementVisitor
134134
private scriptTarget: Exclude<ts.ScriptTarget, ts.ScriptTarget.JSON>) {}
135135

136136
visitDeclareVarStmt(stmt: DeclareVarStmt, context: Context): ts.VariableStatement {
137-
const isConst =
138-
this.scriptTarget >= ts.ScriptTarget.ES2015 && stmt.hasModifier(StmtModifier.Final);
137+
const varType = this.scriptTarget < ts.ScriptTarget.ES2015 ?
138+
ts.NodeFlags.None :
139+
stmt.hasModifier(StmtModifier.Final) ? ts.NodeFlags.Const : ts.NodeFlags.Let;
139140
const varDeclaration = ts.createVariableDeclaration(
140141
/* name */ stmt.name,
141142
/* type */ undefined,
142143
/* initializer */ stmt.value?.visitExpression(this, context.withExpressionMode));
143144
const declarationList = ts.createVariableDeclarationList(
144145
/* declarations */[varDeclaration],
145-
/* flags */ isConst ? ts.NodeFlags.Const : ts.NodeFlags.None);
146+
/* flags */ varType);
146147
const varStatement = ts.createVariableStatement(undefined, declarationList);
147148
return attachComments(varStatement, stmt.leadingComments);
148149
}

‎packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ describe('compiler compliance', () => {
16381638
$r3$.ɵɵviewQuery(SomeDirective, true);
16391639
}
16401640
if (rf & 2) {
1641-
var $tmp$;
1641+
let $tmp$;
16421642
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
16431643
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDirs = $tmp$);
16441644
}
@@ -1697,7 +1697,7 @@ describe('compiler compliance', () => {
16971697
$r3$.ɵɵviewQuery($e1_attrs$, true);
16981698
}
16991699
if (rf & 2) {
1700-
var $tmp$;
1700+
let $tmp$;
17011701
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRef = $tmp$.first);
17021702
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRefs = $tmp$);
17031703
}
@@ -1748,7 +1748,7 @@ describe('compiler compliance', () => {
17481748
$r3$.ɵɵviewQuery($refs$, true);
17491749
}
17501750
if (rf & 2) {
1751-
var $tmp$;
1751+
let $tmp$;
17521752
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
17531753
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.foo = $tmp$.first);
17541754
}
@@ -1814,7 +1814,7 @@ describe('compiler compliance', () => {
18141814
$r3$.ɵɵviewQuery(SomeDirective, true, TemplateRef);
18151815
}
18161816
if (rf & 2) {
1817-
var $tmp$;
1817+
let $tmp$;
18181818
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRef = $tmp$.first);
18191819
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
18201820
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRefs = $tmp$);
@@ -1875,7 +1875,7 @@ describe('compiler compliance', () => {
18751875
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, false);
18761876
}
18771877
if (rf & 2) {
1878-
var $tmp$;
1878+
let $tmp$;
18791879
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
18801880
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDirList = $tmp$);
18811881
}
@@ -1935,7 +1935,7 @@ describe('compiler compliance', () => {
19351935
$r3$.ɵɵcontentQuery(dirIndex, $e1_attrs$, false);
19361936
}
19371937
if (rf & 2) {
1938-
var $tmp$;
1938+
let $tmp$;
19391939
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRef = $tmp$.first);
19401940
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRefs = $tmp$);
19411941
}
@@ -1994,7 +1994,7 @@ describe('compiler compliance', () => {
19941994
$r3$.ɵɵcontentQuery(dirIndex, $ref0$, true);
19951995
}
19961996
if (rf & 2) {
1997-
var $tmp$;
1997+
let $tmp$;
19981998
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
19991999
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.foo = $tmp$.first);
20002000
}
@@ -2061,7 +2061,7 @@ describe('compiler compliance', () => {
20612061
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, false, TemplateRef);
20622062
}
20632063
if (rf & 2) {
2064-
var $tmp$;
2064+
let $tmp$;
20652065
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRef = $tmp$.first);
20662066
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
20672067
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRefs = $tmp$);

‎packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ describe('compiler compliance: bindings', () => {
209209
template: function MyComponent_Template(rf, ctx) {
210210
…
211211
if (rf & 2) {
212-
var $tmp0$ = null;
212+
let $tmp0$ = null;
213213
$r3$.ɵɵproperty("title", ctx.myTitle)("id", ($tmp0$ = $r3$.ɵɵpipeBind1(1, 3, ($tmp0$ = ctx.auth()) == null ? null : $tmp0$.identity())) == null ? null : $tmp0$.id)("tabindex", 1);
214214
}
215215
}
@@ -750,7 +750,7 @@ describe('compiler compliance: bindings', () => {
750750
hostVars: 1,
751751
hostBindings: function HostBindingDir_HostBindings(rf, ctx) {
752752
if (rf & 2) {
753-
var $tmp0$ = null;
753+
let $tmp0$ = null;
754754
$r3$.ɵɵhostProperty("id", ($tmp0$ = ctx.getData()) == null ? null : $tmp0$.id);
755755
}
756756
}

‎packages/compiler-cli/test/compliance/r3_view_compiler_di_spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ describe('compiler compliance: dependency injection', () => {
212212
MyService.ɵprov = $r3$.ɵɵdefineInjectable({
213213
token: MyService,
214214
factory: function MyService_Factory(t) {
215-
var r = null;
215+
let r = null;
216216
if (t) {
217217
r = new t();
218218
} else {
@@ -285,7 +285,7 @@ describe('compiler compliance: dependency injection', () => {
285285
MyService.ɵprov = $r3$.ɵɵdefineInjectable({
286286
token: MyService,
287287
factory: function MyService_Factory(t) {
288-
var r = null;
288+
let r = null;
289289
if (t) {
290290
r = new t();
291291
} else {

‎packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ const i18nMsg = (message: string, placeholders: Placeholder[] = [], meta?: Meta)
251251
const closurePlaceholders = i18nPlaceholdersToString(placeholders);
252252
const locMessageWithPlaceholders = i18nMsgInsertLocalizePlaceholders(message, placeholders);
253253
return String.raw`
254-
var ${varName};
254+
let ${varName};
255255
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
256256
${i18nMsgClosureMeta(meta)}
257257
const $MSG_EXTERNAL_${msgIndex}$ = goog.getMsg("${message}"${closurePlaceholders});
@@ -304,7 +304,7 @@ describe('i18n support in the template compiler', () => {
304304

305305
// Keeping this block as a raw string, since it checks escaping of special chars.
306306
const i18n_6 = String.raw`
307-
var $i18n_23$;
307+
let $i18n_23$;
308308
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
309309
/**
310310
* @desc [BACKUP_$` +
@@ -321,7 +321,7 @@ describe('i18n support in the template compiler', () => {
321321

322322
// Keeping this block as a raw string, since it checks escaping of special chars.
323323
const i18n_7 = String.raw`
324-
var $i18n_7$;
324+
let $i18n_7$;
325325
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
326326
/**
327327
* @desc Some text \' [BACKUP_MESSAGE_ID: xxx]
@@ -780,7 +780,7 @@ describe('i18n support in the template compiler', () => {
780780
$r3$.ɵɵelementEnd();
781781
}
782782
if (rf & 2) {
783-
var $tmp_0_0$ = null;
783+
let $tmp_0_0$ = null;
784784
$r3$.ɵɵi18nExp(($tmp_0_0$ = ctx.valueA.getRawValue()) == null ? null : $tmp_0_0$.getTitle());
785785
$r3$.ɵɵi18nApply(1);
786786
}
@@ -942,7 +942,7 @@ describe('i18n support in the template compiler', () => {
942942
verify(input, output);
943943
});
944944

945-
it('should sanitize ids and generate proper var names', () => {
945+
it('should sanitize ids and generate proper variable names', () => {
946946
const input = `
947947
<div i18n="@@ID.WITH.INVALID.CHARS.2" i18n-title="@@ID.WITH.INVALID.CHARS" title="Element title">
948948
Some content
@@ -951,7 +951,7 @@ describe('i18n support in the template compiler', () => {
951951

952952
// Keeping raw content (avoiding `i18nMsg`) to illustrate message id sanitization.
953953
const output = String.raw`
954-
var $I18N_0$;
954+
let $I18N_0$;
955955
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
956956
const $MSG_EXTERNAL_ID_WITH_INVALID_CHARS$$APP_SPEC_TS_1$ = goog.getMsg("Element title");
957957
$I18N_0$ = $MSG_EXTERNAL_ID_WITH_INVALID_CHARS$$APP_SPEC_TS_1$;
@@ -960,7 +960,7 @@ describe('i18n support in the template compiler', () => {
960960
$I18N_0$ = $localize \`:@@ID.WITH.INVALID.CHARS:Element title\`;
961961
}
962962
…
963-
var $I18N_2$;
963+
let $I18N_2$;
964964
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
965965
const $MSG_EXTERNAL_ID_WITH_INVALID_CHARS_2$$APP_SPEC_TS_4$ = goog.getMsg(" Some content ");
966966
$I18N_2$ = $MSG_EXTERNAL_ID_WITH_INVALID_CHARS_2$$APP_SPEC_TS_4$;
@@ -1018,7 +1018,7 @@ describe('i18n support in the template compiler', () => {
10181018

10191019
// Keeping raw content (avoiding `i18nMsg`) to illustrate quotes escaping.
10201020
const output = String.raw`
1021-
var $I18N_0$;
1021+
let $I18N_0$;
10221022
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
10231023
const $MSG_EXTERNAL_4924931801512133405$$APP_SPEC_TS_0$ = goog.getMsg("Some text 'with single quotes', \"with double quotes\", ` +
10241024
'`with backticks`' + String.raw` and without quotes.");
@@ -1036,7 +1036,7 @@ describe('i18n support in the template compiler', () => {
10361036
const input = '<div i18n>`{{ count }}`</div>';
10371037
// Keeping raw content (avoiding `i18nMsg`) to illustrate backticks escaping.
10381038
const output = String.raw`
1039-
var $I18N_0$;
1039+
let $I18N_0$;
10401040
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
10411041
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("` +
10421042
'`{$interpolation}`' + String.raw`", { "interpolation": "\uFFFD0\uFFFD" });
@@ -1108,7 +1108,7 @@ describe('i18n support in the template compiler', () => {
11081108
// Keeping raw content (avoiding `i18nMsg`) to illustrate how named interpolations are
11091109
// generated.
11101110
const i18n_0 = String.raw`
1111-
var $I18N_0$;
1111+
let $I18N_0$;
11121112
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
11131113
const $MSG_EXTERNAL_7597881511811528589$$APP_SPEC_TS_0$ = goog.getMsg(" Named interpolation: {$phA} Named interpolation with spaces: {$phB} ", {
11141114
"phA": "\uFFFD0\uFFFD",
@@ -1209,7 +1209,7 @@ describe('i18n support in the template compiler', () => {
12091209
$r3$.ɵɵelementEnd();
12101210
}
12111211
if (rf & 2) {
1212-
var $tmp_2_0$ = null;
1212+
let $tmp_2_0$ = null;
12131213
$r3$.ɵɵadvance(2);
12141214
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(2, 3, ctx.valueA))
12151215
(ctx.valueA == null ? null : ctx.valueA.a == null ? null : ctx.valueA.a.b)
@@ -2487,7 +2487,7 @@ describe('i18n support in the template compiler', () => {
24872487
// Keeping raw content (avoiding `i18nMsg`) to illustrate message layout
24882488
// in case of whitespace preserving mode.
24892489
const i18n_0 = String.raw`
2490-
var $I18N_0$;
2490+
let $I18N_0$;
24912491
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
24922492
const $MSG_EXTERNAL_963542717423364282$$APP_SPEC_TS_0$ = goog.getMsg("\n Some text\n {$startTagSpan}Text inside span{$closeTagSpan}\n ", {
24932493
"startTagSpan": "\uFFFD#3\uFFFD",
@@ -2571,7 +2571,7 @@ describe('i18n support in the template compiler', () => {
25712571
`;
25722572

25732573
const output = String.raw`
2574-
var $I18N_0$;
2574+
let $I18N_0$;
25752575
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
25762576
const $MSG_EXTERNAL_4166854826696768832$$APP_SPEC_TS_0$ = goog.getMsg("{VAR_SELECT, select, single {'single quotes'} double {\"double quotes\"} other {other}}");
25772577
$I18N_0$ = $MSG_EXTERNAL_4166854826696768832$$APP_SPEC_TS_0$;
@@ -2914,7 +2914,7 @@ describe('i18n support in the template compiler', () => {
29142914
// Keeping raw content here to illustrate the difference in placeholders generated for
29152915
// goog.getMsg and $localize calls (see last i18n block).
29162916
const i18n_0 = String.raw`
2917-
var $I18N_1$;
2917+
let $I18N_1$;
29182918
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
29192919
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("{VAR_SELECT, select, male {male} female {female} other {other}}");
29202920
$I18N_1$ = $MSG_APP_SPEC_TS_1$;
@@ -2925,7 +2925,7 @@ describe('i18n support in the template compiler', () => {
29252925
$I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, {
29262926
"VAR_SELECT": "\uFFFD0\uFFFD"
29272927
});
2928-
var $I18N_2$;
2928+
let $I18N_2$;
29292929
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
29302930
const $MSG_APP_SPEC_TS_2$ = goog.getMsg("{VAR_SELECT, select, male {male} female {female} other {other}}");
29312931
$I18N_2$ = $MSG_APP_SPEC_TS_2$;
@@ -2936,7 +2936,7 @@ describe('i18n support in the template compiler', () => {
29362936
$I18N_2$ = $r3$.ɵɵi18nPostprocess($I18N_2$, {
29372937
"VAR_SELECT": "\uFFFD1\uFFFD"
29382938
});
2939-
var $I18N_4$;
2939+
let $I18N_4$;
29402940
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
29412941
const $MSG_APP_SPEC_TS__4$ = goog.getMsg("{VAR_SELECT, select, male {male} female {female} other {other}}");
29422942
$I18N_4$ = $MSG_APP_SPEC_TS__4$;
@@ -2947,7 +2947,7 @@ describe('i18n support in the template compiler', () => {
29472947
$I18N_4$ = $r3$.ɵɵi18nPostprocess($I18N_4$, {
29482948
"VAR_SELECT": "\uFFFD0:1\uFFFD"
29492949
});
2950-
var $I18N_0$;
2950+
let $I18N_0$;
29512951
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
29522952
const $MSG_APP_SPEC_TS_0$ = goog.getMsg(" {$icu} {$startTagDiv} {$icu} {$closeTagDiv}{$startTagDiv_1} {$icu} {$closeTagDiv}", {
29532953
"startTagDiv": "\uFFFD#2\uFFFD",
@@ -3345,7 +3345,7 @@ describe('i18n support in the template compiler', () => {
33453345
const input = `<div i18n>Some Message</div>`;
33463346

33473347
const output = String.raw`
3348-
var $I18N_0$;
3348+
let $I18N_0$;
33493349
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) { … }
33503350
else {
33513351
$I18N_0$ = $localize \`:␟ec93160d6d6a8822214060dd7938bf821c22b226␟6795333002533525253:Some Message\`;
@@ -3360,7 +3360,7 @@ describe('i18n support in the template compiler', () => {
33603360
const input = `<div i18n>Some Message</div>`;
33613361

33623362
const output = String.raw`
3363-
var $I18N_0$;
3363+
let $I18N_0$;
33643364
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) { … }
33653365
else {
33663366
$I18N_0$ = $localize \`:␟ec93160d6d6a8822214060dd7938bf821c22b226␟6795333002533525253:Some Message\`;
@@ -3523,7 +3523,7 @@ $` + String.raw`{$I18N_4$}:ICU:\`;
35233523
`;
35243524

35253525
const i18n_0 = String.raw`
3526-
var $I18N_0$;
3526+
let $I18N_0$;
35273527
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
35283528
const $MSG_EXTERNAL_7128002169381370313$$APP_SPEC_TS_1$ = goog.getMsg("{$startTagXhtmlDiv} Count: {$startTagXhtmlSpan}5{$closeTagXhtmlSpan}{$closeTagXhtmlDiv}", {
35293529
"startTagXhtmlDiv": "\uFFFD#3\uFFFD",
@@ -3584,7 +3584,7 @@ $` + String.raw`{$I18N_4$}:ICU:\`;
35843584
`;
35853585

35863586
const i18n_0 = String.raw`
3587-
var $I18N_0$;
3587+
let $I18N_0$;
35883588
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
35893589
const $MSG_EXTERNAL_7428861019045796010$$APP_SPEC_TS_1$ = goog.getMsg(" Count: {$startTagXhtmlSpan}5{$closeTagXhtmlSpan}", {
35903590
"startTagXhtmlSpan": "\uFFFD#4\uFFFD",

0 commit comments

Comments
 (0)