diff --git a/modules/benchmarks/src/tree/render3_function/index.ts b/modules/benchmarks/src/tree/render3_function/index.ts index 77296b8512a96e..999dcddf8eb9b3 100644 --- a/modules/benchmarks/src/tree/render3_function/index.ts +++ b/modules/benchmarks/src/tree/render3_function/index.ts @@ -24,7 +24,7 @@ export class TreeFunction { static ngComponentDef = ɵɵdefineComponent({ type: TreeFunction, selectors: [['tree']], - consts: 5, + decls: 5, vars: 1, template: function(rf: ɵRenderFlags, ctx: TreeFunction) { // bit of a hack diff --git a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts index 5bfac8a122e059..41514bcdc0175c 100644 --- a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts @@ -189,7 +189,7 @@ runInEachFileSystem(() => { const addDefinitionsSpy = testFormatter.addDefinitions as jasmine.Spy; expect(addDefinitionsSpy.calls.first().args[2]) .toEqual(`A.ngFactoryDef = function A_Factory(t) { return new (t || A)(); }; -A.ngComponentDef = ɵngcc0.ɵɵdefineComponent({ type: A, selectors: [["a"]], consts: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) { +A.ngComponentDef = ɵngcc0.ɵɵdefineComponent({ type: A, selectors: [["a"]], decls: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) { ɵngcc0.ɵɵtext(0); } if (rf & 2) { ɵngcc0.ɵɵtextInterpolate(ctx.person.name); diff --git a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts index 237304f1769613..1e3c2d589adc39 100644 --- a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts @@ -478,7 +478,7 @@ describe('compiler compliance', () => { 'MyComponent.ngFactoryDef = function MyComponent_Factory(t) { return new (t || MyComponent)(); }'; const template = ` MyComponent.ngComponentDef = i0.ɵɵdefineComponent({type:MyComponent,selectors:[["my-component"]], - consts: 1, + decls: 1, vars: 2, template: function MyComponent_Template(rf,ctx){ if (rf & 1) { @@ -568,7 +568,7 @@ describe('compiler compliance', () => { ChildComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: ChildComponent, selectors: [["child"]], - consts: 1, + decls: 1, vars: 0, template: function ChildComponent_Template(rf, ctx) { if (rf & 1) { @@ -598,7 +598,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 2, + decls: 2, vars: 0, attrs: [["some-directive", ""]], template: function MyComponent_Template(rf, ctx) { @@ -696,7 +696,7 @@ describe('compiler compliance', () => { EmptyOutletComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: EmptyOutletComponent, selectors: [["ng-component"]], - consts: 1, + decls: 1, vars: 0, template: function EmptyOutletComponent_Template(rf, ctx) { if (rf & 1) { @@ -745,7 +745,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 0, + decls: 0, vars: 0, template: function MyComponent_Template(rf, ctx) {}, encapsulation: 2 @@ -816,7 +816,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 3, + decls: 3, vars: 0, attrs: [[${AttributeMarker.Template}, "if"]], template: function MyComponent_Template(rf, ctx) { @@ -883,7 +883,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 1, + decls: 1, vars: 3, attrs: [[${AttributeMarker.Bindings}, "names"]], template: function MyApp_Template(rf, ctx) { @@ -964,7 +964,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 1, + decls: 1, vars: 11, attrs: [[${AttributeMarker.Bindings}, "names"]], template: function MyApp_Template(rf, ctx) { @@ -1026,7 +1026,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 1, + decls: 1, vars: 3, attrs: [[${AttributeMarker.Bindings}, "config"]], template: function MyApp_Template(rf, ctx) { @@ -1093,7 +1093,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 1, + decls: 1, vars: 8, attrs: [[${AttributeMarker.Bindings}, "config"]], template: function MyApp_Template(rf, ctx) { @@ -1155,7 +1155,7 @@ describe('compiler compliance', () => { type: SimpleComponent, selectors: [["simple"]], ngContentSelectors: $c0$, - consts: 2, + decls: 2, vars: 0, template: function SimpleComponent_Template(rf, ctx) { if (rf & 1) { @@ -1175,7 +1175,7 @@ describe('compiler compliance', () => { type: ComplexComponent, selectors: [["complex"]], ngContentSelectors: $c2$, - consts: 4, + decls: 4, vars: 0, attrs: [["id","first"], ["id","second"]], template: function ComplexComponent_Template(rf, ctx) { @@ -1231,7 +1231,7 @@ describe('compiler compliance', () => { type: Cmp, selectors: [["ng-component"]], ngContentSelectors: $c1$, - consts: 3, + decls: 3, vars: 0, template: function Cmp_Template(rf, ctx) { if (rf & 1) { @@ -1414,7 +1414,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 2, + decls: 2, vars: 0, attrs: [[5, ["", "title", ""]]], template: function MyApp_Template(rf, ctx) { @@ -1466,7 +1466,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 2, + decls: 2, vars: 0, attrs: [[5, ["", "title", ""]]], template: function MyApp_Template(rf, ctx) { @@ -1540,7 +1540,7 @@ describe('compiler compliance', () => { $r3$.ɵɵqueryRefresh(($tmp$ = $r3$.ɵɵloadQuery())) && (ctx.someDirs = $tmp$); } }, - consts: 1, + decls: 1, vars: 0, attrs: [["someDir",""]], template: function ViewQueryComponent_Template(rf, ctx) { @@ -1650,7 +1650,7 @@ describe('compiler compliance', () => { $r3$.ɵɵqueryRefresh(($tmp$ = $r3$.ɵɵloadQuery())) && (ctx.foo = $tmp$.first); } }, - consts: 1, + decls: 1, vars: 0, attrs: [["someDir",""]], template: function ViewQueryComponent_Template(rf, ctx) { @@ -1778,7 +1778,7 @@ describe('compiler compliance', () => { } }, ngContentSelectors: _c0, - consts: 2, + decls: 2, vars: 0, template: function ContentQueryComponent_Template(rf, ctx) { if (rf & 1) { @@ -1897,7 +1897,7 @@ describe('compiler compliance', () => { } }, ngContentSelectors: $_c1$, - consts: 2, + decls: 2, vars: 0, template: function ContentQueryComponent_Template(rf, ctx) { if (rf & 1) { @@ -2048,7 +2048,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 7, + decls: 7, vars: 20, template: function MyApp_Template(rf, ctx) { if (rf & 1) { @@ -2115,7 +2115,7 @@ describe('compiler compliance', () => { MyApp.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyApp, selectors: [["my-app"]], - consts: 6, + decls: 6, vars: 27, template: function MyApp_Template(rf, ctx) { if (rf & 1) { @@ -2238,7 +2238,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 3, + decls: 3, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2333,7 +2333,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 6, + decls: 6, vars: 1, attrs: [[${AttributeMarker.Template}, "if"]], template: function MyComponent_Template(rf, ctx) { @@ -2480,7 +2480,7 @@ describe('compiler compliance', () => { selectors: [["lifecycle-comp"]], inputs: {nameMin: ["name", "nameMin"]}, features: [$r3$.ɵɵNgOnChangesFeature()], - consts: 0, + decls: 0, vars: 0, template: function LifecycleComp_Template(rf, ctx) {}, encapsulation: 2 @@ -2490,7 +2490,7 @@ describe('compiler compliance', () => { SimpleLayout.ngComponentDef = $r3$.ɵɵdefineComponent({ type: SimpleLayout, selectors: [["simple-layout"]], - consts: 2, + decls: 2, vars: 2, attrs: [[3, "name"]], template: function SimpleLayout_Template(rf, ctx) { @@ -2622,7 +2622,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 2, + decls: 2, vars: 1, attrs: [[${AttributeMarker.Template}, "for", "forOf"]], template: function MyComponent_Template(rf, ctx){ @@ -2708,7 +2708,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 2, + decls: 2, vars: 1, attrs: [[${AttributeMarker.Template}, "for", "forOf"]], template: function MyComponent_Template(rf, ctx) { @@ -2812,7 +2812,7 @@ describe('compiler compliance', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 2, + decls: 2, vars: 1, attrs: [[${AttributeMarker.Template}, "for", "forOf"]], template: function MyComponent_Template(rf, ctx) { diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts index d42f54b007ea41..5e0c3e26107801 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts @@ -725,7 +725,7 @@ describe('compiler compliance: bindings', () => { $r3$.ɵɵhostProperty("id", $r3$.ɵɵpureFunction1(1, $ff$, ctx.id)); } }, - consts: 0, + decls: 0, vars: 0, template: function HostBindingComp_Template(rf, ctx) {}, encapsulation: 2 diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_directives_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_directives_spec.ts index cc854de07c40a6..744f550918bf88 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_directives_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_directives_spec.ts @@ -41,7 +41,7 @@ describe('compiler compliance: directives', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 1, + decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -91,7 +91,7 @@ describe('compiler compliance: directives', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 1, + decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts index f4c5a0a0d0bdbc..75def9ce2693c3 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts @@ -471,7 +471,7 @@ describe('i18n support in the template compiler', () => { "aria-roledescription", $I18N_7$ ]; … - consts: 5, + decls: 5, vars: 8, attrs: [["id", "dynamic-1", ${AttributeMarker.I18n}, "aria-roledescription", "title", "aria-label"], ["id", "dynamic-2", ${AttributeMarker.I18n}, "title", "aria-roledescription"]], template: function MyComponent_Template(rf, ctx) { @@ -576,7 +576,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 1, + decls: 1, vars: 1, attrs: [[${AttributeMarker.Template}, "ngFor", "ngForOf"], [${AttributeMarker.I18n}, "title"]], template: function MyComponent_Template(rf, ctx) { @@ -611,7 +611,7 @@ describe('i18n support in the template compiler', () => { } const $_c3$ = ["title", $I18N_1$]; … - consts: 2, + decls: 2, vars: 1, attrs: [[${AttributeMarker.I18n}, "title"]], template: function MyComponent_Template(rf, ctx) { @@ -722,7 +722,7 @@ describe('i18n support in the template compiler', () => { "aria-roledescription", $I18N_7$ ]; … - consts: 5, + decls: 5, vars: 8, attrs: [[ "id", "dynamic-1", @@ -790,7 +790,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 1, + decls: 1, vars: 1, attrs: [[${AttributeMarker.Template}, "ngFor", "ngForOf"], [${AttributeMarker.I18n}, "title"]], template: function MyComponent_Template(rf, ctx) { @@ -1029,7 +1029,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD1\uFFFD"}:PH_B: \`; } … - consts: 2, + decls: 2, vars: 2, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -1166,7 +1166,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } … - consts: 7, + decls: 7, vars: 5, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -1254,7 +1254,7 @@ describe('i18n support in the template compiler', () => { } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$); … - consts: 9, + decls: 9, vars: 5, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -1360,7 +1360,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD/#7\uFFFD"}:CLOSE_TAG_SPAN:\`; } … - consts: 9, + decls: 9, vars: 7, attrs: [[${AttributeMarker.I18n}, "title"]], template: function MyComponent_Template(rf, ctx) { @@ -1449,7 +1449,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 1, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -1507,7 +1507,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 2, attrs: [["src", "logo.png"], ["src", "logo.png", ${AttributeMarker.Template}, "ngIf"], ["src", "logo.png", ${AttributeMarker.Bindings}, "title", ${AttributeMarker.Template}, "ngIf"], ["src", "logo.png", ${AttributeMarker.I18n}, "title"]], template: function MyComponent_Template(rf, ctx) { @@ -1648,7 +1648,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 4, + decls: 4, vars: 2, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -1709,7 +1709,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 1, + decls: 1, vars: 1, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -1801,7 +1801,7 @@ describe('i18n support in the template compiler', () => { "VAR_SELECT": "\uFFFD0\uFFFD" }); … - consts: 2, + decls: 2, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -1885,7 +1885,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $localize \`:@@4722270221386399294:Text #2\`; } … - consts: 4, + decls: 4, vars: 0, attrs: [[${AttributeMarker.Classes}, "myClass"], [${AttributeMarker.Styles}, "padding", "10px"]], template: function MyComponent_Template(rf, ctx) { @@ -1923,7 +1923,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } … - consts: 3, + decls: 3, vars: 3, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -1970,7 +1970,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 1, + decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2024,7 +2024,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 5, + decls: 5, vars: 3, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2086,7 +2086,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2184,7 +2184,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2240,7 +2240,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2398,7 +2398,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_NG_CONTAINER:\`; } … - consts: 3, + decls: 3, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2436,7 +2436,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_NG_CONTAINER:\`; } … - consts: 4, + decls: 4, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2495,7 +2495,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 2, + decls: 2, vars: 2, attrs: [[4, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -2574,7 +2574,7 @@ describe('i18n support in the template compiler', () => { "VAR_SELECT": "\uFFFD0\uFFFD" }); … - consts: 2, + decls: 2, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2632,7 +2632,7 @@ describe('i18n support in the template compiler', () => { "VAR_SELECT": "\uFFFD0\uFFFD" }); … - consts: 1, + decls: 1, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2723,7 +2723,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 4, + decls: 4, vars: 3, attrs: [["title", "icu only", ${AttributeMarker.Template}, "ngIf"], ["title", "icu and text", ${AttributeMarker.Template}, "ngIf"], ["title", "icu only"], ["title", "icu and text"]], template: function MyComponent_Template(rf, ctx) { @@ -2834,7 +2834,7 @@ describe('i18n support in the template compiler', () => { String.raw `{"\uFFFD/#3\uFFFD"}:CLOSE_TAG_DIV:\`; } … - consts: 5, + decls: 5, vars: 1, attrs: [[1, "other"]], template: function MyComponent_Template(rf, ctx) { @@ -2877,7 +2877,7 @@ describe('i18n support in the template compiler', () => { "INTERPOLATION": "\uFFFD1\uFFFD" }); … - consts: 2, + decls: 2, vars: 2, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -2939,7 +2939,7 @@ describe('i18n support in the template compiler', () => { String.raw `{$I18N_1$}:ICU: $` + String.raw `{$I18N_2$}:ICU_1: \`; } … - consts: 2, + decls: 2, vars: 2, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -3040,7 +3040,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 4, + decls: 4, vars: 3, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -3100,7 +3100,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $localize \`:@@3052001905251380936: $` + String.raw `{$I18N_1$}:ICU: \`; } … - consts: 2, + decls: 2, vars: 2, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -3148,7 +3148,7 @@ describe('i18n support in the template compiler', () => { "INTERPOLATION": "\uFFFD2\uFFFD" }); … - consts: 2, + decls: 2, vars: 3, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -3229,7 +3229,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 2, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -3318,7 +3318,7 @@ describe('i18n support in the template compiler', () => { } } … - consts: 3, + decls: 3, vars: 4, attrs: [[${AttributeMarker.Template}, "ngIf"]], template: function MyComponent_Template(rf, ctx) { @@ -3368,7 +3368,7 @@ describe('i18n support in the template compiler', () => { "PH_WITH_SPACES": "\uFFFD3\uFFFD" }); … - consts: 2, + decls: 2, vars: 4, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_listener_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_listener_spec.ts index 0312f1922de284..fde3117b10ba07 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_listener_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_listener_spec.ts @@ -198,7 +198,7 @@ describe('compiler compliance: listen()', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 4, + decls: 4, vars: 0, attrs: [[${AttributeMarker.Bindings}, "click"]], template: function MyComponent_Template(rf, ctx) { diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_providers_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_providers_spec.ts index 08cf2e3810475f..bcbf2b29a2e5fa 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_providers_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_providers_spec.ts @@ -148,7 +148,7 @@ describe('compiler compliance: providers', () => { MyComponent.ngComponentDef = i0.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 1, + decls: 1, vars: 0, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts index fc639fead9822f..0997fd9d42f921 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts @@ -131,7 +131,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors:[["my-component"]], - consts: 0, + decls: 0, vars: 0, template: function MyComponent_Template(rf, $ctx$) { }, @@ -170,7 +170,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors:[["my-component"]], - consts: 0, + decls: 0, vars: 0, template: function MyComponent_Template(rf, $ctx$) { }, @@ -211,7 +211,7 @@ describe('compiler compliance: styling', () => { … MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ … - consts: 3, + decls: 3, vars: 3, template: function MyComponent_Template(rf, $ctx$) { if (rf & 1) { @@ -272,7 +272,7 @@ describe('compiler compliance: styling', () => { … MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ … - consts: 1, + decls: 1, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -435,7 +435,7 @@ describe('compiler compliance: styling', () => { const template = ` … - consts: 1, + decls: 1, vars: 2, template: function MyComponentWithInterpolation_Template(rf, $ctx$) { if (rf & 1) { @@ -446,7 +446,7 @@ describe('compiler compliance: styling', () => { } } … - consts: 1, + decls: 1, vars: 3, template: function MyComponentWithMuchosInterpolation_Template(rf, $ctx$) { if (rf & 1) { @@ -457,7 +457,7 @@ describe('compiler compliance: styling', () => { } } … - consts: 1, + decls: 1, vars: 1, template: function MyComponentWithoutInterpolation_Template(rf, $ctx$) { if (rf & 1) { @@ -505,7 +505,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors:[["my-component"]], - consts: 1, + decls: 1, vars: 4, attrs: [[${AttributeMarker.Styles}, "opacity", "1"]], template: function MyComponent_Template(rf, $ctx$) { @@ -553,7 +553,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors: [["my-component"]], - consts: 1, + decls: 1, vars: 1, template: function MyComponent_Template(rf, ctx) { if (rf & 1) { @@ -699,7 +699,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors:[["my-component"]], - consts: 1, + decls: 1, vars: 4, attrs: [[${AttributeMarker.Classes}, "grape"]], template: function MyComponent_Template(rf, $ctx$) { @@ -748,7 +748,7 @@ describe('compiler compliance: styling', () => { MyComponent.ngComponentDef = $r3$.ɵɵdefineComponent({ type: MyComponent, selectors:[["my-component"]], - consts: 1, + decls: 1, vars: 2, attrs: [[${AttributeMarker.Classes}, "foo", ${AttributeMarker.Styles}, "width", "100px"]], template: function MyComponent_Template(rf, $ctx$) { @@ -1029,7 +1029,7 @@ describe('compiler compliance: styling', () => { $r3$.ɵɵclassProp("foo", ctx.myFooClass); } }, - consts: 0, + decls: 0, vars: 0, `; @@ -1089,7 +1089,7 @@ describe('compiler compliance: styling', () => { $r3$.ɵɵclassProp("foo", ctx.myFooClass); } }, - consts: 0, + decls: 0, vars: 0, `; diff --git a/packages/compiler/src/render3/view/compiler.ts b/packages/compiler/src/render3/view/compiler.ts index 4292fd04e0023b..f25ea2d8882734 100644 --- a/packages/compiler/src/render3/view/compiler.ts +++ b/packages/compiler/src/render3/view/compiler.ts @@ -240,8 +240,8 @@ export function compileComponentFromMetadata( definitionMap.set('ngContentSelectors', ngContentSelectors); } - // e.g. `consts: 2` - definitionMap.set('consts', o.literal(templateBuilder.getConstCount())); + // e.g. `decls: 2` + definitionMap.set('decls', o.literal(templateBuilder.getConstCount())); // e.g. `vars: 2` definitionMap.set('vars', o.literal(templateBuilder.getVarCount())); diff --git a/packages/core/src/render3/VIEW_DATA.md b/packages/core/src/render3/VIEW_DATA.md index 4c0def577061a7..1fb05e0bb9d2d4 100644 --- a/packages/core/src/render3/VIEW_DATA.md +++ b/packages/core/src/render3/VIEW_DATA.md @@ -28,7 +28,7 @@ Mostly information such as parent `LView`, `Sanitizer`, `TView`, and many more b ## `CONSTS` `CONSTS` contain the DOM elements, pipe instances, and local refs. -The size of the `CONSTS` section is declared in the property `consts` of the component definition. +The size of the `CONSTS` section is declared in the property `decls` of the component definition. ```typescript @Component({ @@ -38,7 +38,7 @@ class MyApp { static ngComponentDef = ɵɵdefineComponent({ ..., - consts: 5, + decls: 5, template: function(rf: RenderFlags, ctx: MyApp) { if (rf & RenderFlags.Create) { ɵɵelementStart(0, 'div'); @@ -89,7 +89,7 @@ class MyApp { static ngComponentDef = ɵɵdefineComponent({ ..., - consts: 2, // Two DOM Elements. + decls: 2, // Two DOM Elements. vars: 2, // Two bindings. template: function(rf: RenderFlags, ctx: MyApp) { if (rf & RenderFlags.Create) { @@ -142,7 +142,7 @@ class MyApp { static ngComponentDef = ɵɵdefineComponent({ ..., - consts: 1, + decls: 1, template: function(rf: RenderFlags, ctx: MyApp) { if (rf & RenderFlags.Create) { ɵɵelement(0, 'child', ['tooltip', null]); @@ -276,7 +276,7 @@ class MyApp { static ngComponentDef = ɵɵdefineComponent({ ..., - consts: 1, + decls: 1, template: function(rf: RenderFlags, ctx: MyApp) { if (rf & RenderFlags.Create) { ɵɵelement(0, 'child'); diff --git a/packages/core/src/render3/definition.ts b/packages/core/src/render3/definition.ts index 9daa76c3c99411..51f7be5fa74f10 100644 --- a/packages/core/src/render3/definition.ts +++ b/packages/core/src/render3/definition.ts @@ -57,7 +57,7 @@ export function ɵɵdefineComponent(componentDefinition: { * can pre-fill the array and set the binding start index. */ // TODO(kara): remove queries from this count - consts: number; + decls: number; /** * The number of bindings in this component template (including pure fn bindings). @@ -252,7 +252,7 @@ export function ɵɵdefineComponent(componentDefinition: { const def: Mutable, keyof ComponentDef> = { type: type, providersResolver: null, - consts: componentDefinition.consts, + decls: componentDefinition.decls, vars: componentDefinition.vars, factory: null, template: componentDefinition.template || null !, diff --git a/packages/core/src/render3/features/providers_feature.ts b/packages/core/src/render3/features/providers_feature.ts index cecf40697036f9..c0e3255a1b02a5 100644 --- a/packages/core/src/render3/features/providers_feature.ts +++ b/packages/core/src/render3/features/providers_feature.ts @@ -22,7 +22,7 @@ import {DirectiveDef} from '../interfaces/definition'; * type: ComponentWithProviders, * selectors: [['component-with-providers']], * factory: () => new ComponentWithProviders(directiveInject(GreeterDE as any)), - * consts: 1, + * decls: 1, * vars: 1, * template: function(fs: RenderFlags, ctx: ComponentWithProviders) { * if (fs & RenderFlags.Create) { diff --git a/packages/core/src/render3/instructions/container.ts b/packages/core/src/render3/instructions/container.ts index b2675e8c34e388..c97821613a1fcc 100644 --- a/packages/core/src/render3/instructions/container.ts +++ b/packages/core/src/render3/instructions/container.ts @@ -53,7 +53,7 @@ export function ɵɵcontainer(index: number): void { * * @param index The index of the container in the data array * @param templateFn Inline template - * @param consts The number of nodes, local refs, and pipes for this template + * @param decls The number of nodes, local refs, and pipes for this template * @param vars The number of bindings for this template * @param tagName The name of the container element, if applicable * @param attrsIndex Index of template in the attributes array. @@ -64,7 +64,7 @@ export function ɵɵcontainer(index: number): void { * @codeGenApi */ export function ɵɵtemplate( - index: number, templateFn: ComponentTemplate| null, consts: number, vars: number, + index: number, templateFn: ComponentTemplate| null, decls: number, vars: number, tagName?: string | null, attrsIndex?: number | null, localRefs?: string[] | null, localRefExtractor?: LocalRefExtractor) { const lView = getLView(); @@ -81,7 +81,7 @@ export function ɵɵtemplate( registerPostOrderHooks(tView, tContainerNode); const embeddedTView = tContainerNode.tViews = createTView( - -1, templateFn, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null, + -1, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewAttrs); const embeddedTViewNode = createTNode(tView, null, TNodeType.View, -1, null, null) as TViewNode; embeddedTViewNode.injectorIndex = tContainerNode.injectorIndex; diff --git a/packages/core/src/render3/instructions/embedded_view.ts b/packages/core/src/render3/instructions/embedded_view.ts index 28ca8f1816fc6e..a3f9b52f6ca00e 100644 --- a/packages/core/src/render3/instructions/embedded_view.ts +++ b/packages/core/src/render3/instructions/embedded_view.ts @@ -28,8 +28,7 @@ import {assignTViewNodeToLView, createLView, createTView, refreshView, renderVie * * @codeGenApi */ -export function ɵɵembeddedViewStart( - viewBlockId: number, consts: number, vars: number): RenderFlags { +export function ɵɵembeddedViewStart(viewBlockId: number, decls: number, vars: number): RenderFlags { const lView = getLView(); const previousOrParentTNode = getPreviousOrParentTNode(); // The previous node can be a view node if we are processing an inline for loop @@ -47,9 +46,8 @@ export function ɵɵembeddedViewStart( } else { // When we create a new LView, we always reset the state of the instructions. viewToRender = createLView( - lView, - getOrCreateEmbeddedTView(viewBlockId, consts, vars, containerTNode as TContainerNode), null, - LViewFlags.CheckAlways, null, null); + lView, getOrCreateEmbeddedTView(viewBlockId, decls, vars, containerTNode as TContainerNode), + null, LViewFlags.CheckAlways, null, null); const tParentNode = getIsParent() ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent; @@ -75,13 +73,13 @@ export function ɵɵembeddedViewStart( * it with the same index (since it's in the same template). * * @param viewIndex The index of the TView in TNode.tViews - * @param consts The number of nodes, local refs, and pipes in this template + * @param decls The number of nodes, local refs, and pipes in this template * @param vars The number of bindings and pure function bindings in this template * @param container The parent container in which to look for the view's static data * @returns TView */ function getOrCreateEmbeddedTView( - viewIndex: number, consts: number, vars: number, parent: TContainerNode): TView { + viewIndex: number, decls: number, vars: number, parent: TContainerNode): TView { const tView = getLView()[TVIEW]; ngDevMode && assertNodeType(parent, TNodeType.Container); const containerTViews = parent.tViews as TView[]; @@ -89,7 +87,7 @@ function getOrCreateEmbeddedTView( ngDevMode && assertEqual(Array.isArray(containerTViews), true, 'TViews should be in an array'); if (viewIndex >= containerTViews.length || containerTViews[viewIndex] == null) { containerTViews[viewIndex] = createTView( - viewIndex, null, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null, null, + viewIndex, null, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, null, tView.attrs); } return containerTViews[viewIndex]; diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index 02cf80acff17db..ee87f65ce50355 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -566,7 +566,7 @@ export function saveResolvedLocalsInData( */ export function getOrCreateTView(def: ComponentDef): TView { return def.tView || (def.tView = createTView( - -1, def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, + -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.attrs)); } @@ -576,7 +576,7 @@ export function getOrCreateTView(def: ComponentDef): TView { * * @param viewIndex The viewBlockId for inline views, or -1 if it's a component/dynamic * @param templateFn Template function - * @param consts The number of nodes, local refs, and pipes in this template + * @param decls The number of nodes, local refs, and pipes in this template * @param directives Registry of directives for this view * @param pipes Registry of pipes for this view * @param viewQuery View queries for this view @@ -584,12 +584,12 @@ export function getOrCreateTView(def: ComponentDef): TView { * @param attrs Attributes for tis view */ export function createTView( - viewIndex: number, templateFn: ComponentTemplate| null, consts: number, vars: number, + viewIndex: number, templateFn: ComponentTemplate| null, decls: number, vars: number, directives: DirectiveDefListOrFactory | null, pipes: PipeDefListOrFactory | null, viewQuery: ViewQueriesFunction| null, schemas: SchemaMetadata[] | null, attrs: TAttributes[] | null): TView { ngDevMode && ngDevMode.tView++; - const bindingStartIndex = HEADER_OFFSET + consts; + const bindingStartIndex = HEADER_OFFSET + decls; // This length does not yet contain host bindings from child directives because at this point, // we don't know which directives are active on this template. As soon as a directive is matched // that has a host binding, we will update the blueprint with that def's hostVars count. diff --git a/packages/core/src/render3/interfaces/definition.ts b/packages/core/src/render3/interfaces/definition.ts index 676473800fe431..8e57579e937cc6 100644 --- a/packages/core/src/render3/interfaces/definition.ts +++ b/packages/core/src/render3/interfaces/definition.ts @@ -261,7 +261,7 @@ export interface ComponentDef extends DirectiveDef { * can pre-fill the array and set the binding start index. */ // TODO(kara): remove queries from this count - readonly consts: number; + readonly decls: number; /** * The number of bindings in this component template (including pure fn bindings). diff --git a/packages/core/src/render3/interfaces/view.ts b/packages/core/src/render3/interfaces/view.ts index f9c5a3134b3a1b..f214dfda1e7f15 100644 --- a/packages/core/src/render3/interfaces/view.ts +++ b/packages/core/src/render3/interfaces/view.ts @@ -387,7 +387,7 @@ export interface TView { /** * The index where the "expando" section of `LView` begins. The expando * section contains injectors, directive instances, and host binding values. - * Unlike the "consts" and "vars" sections of `LView`, the length of this + * Unlike the "decls" and "vars" sections of `LView`, the length of this * section cannot be calculated at compile-time because directives are matched * at runtime to preserve locality. * diff --git a/packages/core/src/render3/pure_function.ts b/packages/core/src/render3/pure_function.ts index 62f3fd7ea282a4..d0c5cc59acecd0 100644 --- a/packages/core/src/render3/pure_function.ts +++ b/packages/core/src/render3/pure_function.ts @@ -14,7 +14,7 @@ import {isCreationMode} from './util/view_utils'; /** * Bindings for pure functions are stored after regular bindings. * - * |------consts------|---------vars---------| |----- hostVars (dir1) ------| + * |-------decls------|---------vars---------| |----- hostVars (dir1) ------| * ------------------------------------------------------------------------------------------ * | nodes/refs/pipes | bindings | fn slots | injector | dir1 | host bindings | host slots | * ------------------------------------------------------------------------------------------ diff --git a/packages/core/test/render3/basic_perf.ts b/packages/core/test/render3/basic_perf.ts index c1c9d550814d02..7a8a371501ebc1 100644 --- a/packages/core/test/render3/basic_perf.ts +++ b/packages/core/test/render3/basic_perf.ts @@ -37,7 +37,7 @@ describe('iv perf test', () => { static ngComponentDef = ɵɵdefineComponent({ type: Component, selectors: [['div']], - consts: 1, + decls: 1, vars: 0, template: function Template(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/change_detection_spec.ts b/packages/core/test/render3/change_detection_spec.ts index e91403c0b93d56..f331676993717e 100644 --- a/packages/core/test/render3/change_detection_spec.ts +++ b/packages/core/test/render3/change_detection_spec.ts @@ -29,7 +29,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComponent, selectors: [['my-comp']], - consts: 2, + decls: 2, vars: 1, template: (rf: RenderFlags, ctx: MyComponent) => { if (rf & RenderFlags.Create) { @@ -105,7 +105,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComponent, selectors: [['my-comp']], - consts: 2, + decls: 2, vars: 2, /** * {{ doCheckCount }} - {{ name }} @@ -143,7 +143,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: ManualComponent, selectors: [['manual-comp']], - consts: 2, + decls: 2, vars: 2, /** * {{ doCheckCount }} - {{ name }} @@ -179,7 +179,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: ManualApp, selectors: [['manual-app']], - consts: 1, + decls: 1, vars: 1, /** */ template: (rf: RenderFlags, ctx: ManualApp) => { @@ -234,7 +234,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: ButtonParent, selectors: [['button-parent']], - consts: 2, + decls: 2, vars: 1, /** {{ doCheckCount }} - */ template: (rf: RenderFlags, ctx: ButtonParent) => { @@ -311,7 +311,7 @@ describe('change detection', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComponent, selectors: [['my-comp']], - consts: 1, + decls: 1, vars: 1, template: (rf: RenderFlags, ctx: MyComponent) => { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/component_ref_spec.ts b/packages/core/test/render3/component_ref_spec.ts index 10894f2f4da079..f2becf5258101b 100644 --- a/packages/core/test/render3/component_ref_spec.ts +++ b/packages/core/test/render3/component_ref_spec.ts @@ -24,7 +24,7 @@ describe('ComponentFactory', () => { static ngComponentDef = ɵɵdefineComponent({ type: TestComponent, selectors: [['test', 'foo'], ['bar']], - consts: 0, + decls: 0, vars: 0, template: () => undefined, }); @@ -46,7 +46,7 @@ describe('ComponentFactory', () => { type: TestComponent, encapsulation: ViewEncapsulation.None, selectors: [['test', 'foo'], ['bar']], - consts: 0, + decls: 0, vars: 0, template: () => undefined, ngContentSelectors: ['*', 'a', 'b'], @@ -94,7 +94,7 @@ describe('ComponentFactory', () => { type: TestComponent, encapsulation: ViewEncapsulation.None, selectors: [['test']], - consts: 0, + decls: 0, vars: 0, template: () => undefined, }); diff --git a/packages/core/test/render3/component_spec.ts b/packages/core/test/render3/component_spec.ts index ac7cc2fc33afd1..698112583720b7 100644 --- a/packages/core/test/render3/component_spec.ts +++ b/packages/core/test/render3/component_spec.ts @@ -26,7 +26,7 @@ describe('component', () => { type: CounterComponent, encapsulation: ViewEncapsulation.None, selectors: [['counter']], - consts: 1, + decls: 1, vars: 1, template: function(rf: RenderFlags, ctx: CounterComponent) { if (rf & RenderFlags.Create) { @@ -76,7 +76,7 @@ describe('component', () => { type: MyComponent, encapsulation: ViewEncapsulation.None, selectors: [['my-component']], - consts: 1, + decls: 1, vars: 1, template: function(fs: RenderFlags, ctx: MyComponent) { if (fs & RenderFlags.Create) { @@ -119,7 +119,7 @@ describe('component', () => { static ngComponentDef = ɵɵdefineComponent({ type: Comp, selectors: [['comp']], - consts: 1, + decls: 1, vars: 1, template: (rf: RenderFlags, ctx: Comp) => { if (rf & RenderFlags.Create) { @@ -178,7 +178,7 @@ it('should not invoke renderer destroy method for embedded views', () => { static ngComponentDef = ɵɵdefineComponent({ type: Comp, selectors: [['comp']], - consts: 3, + decls: 3, vars: 1, directives: [NgIf], attrs: [[AttributeMarker.Template, 'ngIf']], @@ -252,7 +252,7 @@ describe('component with a container', () => { type: WrapperComponent, encapsulation: ViewEncapsulation.None, selectors: [['wrapper']], - consts: 1, + decls: 1, vars: 0, template: function ChildComponentTemplate(rf: RenderFlags, ctx: {items: string[]}) { if (rf & RenderFlags.Create) { @@ -329,7 +329,7 @@ describe('recursive components', () => { type: TreeComponent, encapsulation: ViewEncapsulation.None, selectors: [['tree-comp']], - consts: 3, + decls: 3, vars: 1, template: (rf: RenderFlags, ctx: TreeComponent) => { if (rf & RenderFlags.Create) { @@ -395,7 +395,7 @@ describe('recursive components', () => { type: NgIfTree, encapsulation: ViewEncapsulation.None, selectors: [['ng-if-tree']], - consts: 3, + decls: 3, vars: 3, attrs: [[AttributeMarker.Bindings, 'data', AttributeMarker.Template, 'ngIf']], template: (rf: RenderFlags, ctx: NgIfTree) => { @@ -538,7 +538,7 @@ describe('recursive components', () => { encapsulation: ViewEncapsulation.None, selectors: [['test-inputs']], inputs: {minifiedName: 'unminifiedName'}, - consts: 0, + decls: 0, vars: 0, template: function(rf: RenderFlags, ctx: TestInputsComponent): void { // Template not needed for this test diff --git a/packages/core/test/render3/control_flow_spec.ts b/packages/core/test/render3/control_flow_spec.ts index 0c491d5351a211..c03825bb85b5d2 100644 --- a/packages/core/test/render3/control_flow_spec.ts +++ b/packages/core/test/render3/control_flow_spec.ts @@ -702,7 +702,7 @@ describe('JS control flow', () => { static ngComponentDef = ɵɵdefineComponent({ type: Comp, selectors: [['comp']], - consts: 0, + decls: 0, vars: 0, template: function(rf: RenderFlags, ctx: Comp) {} }); @@ -716,7 +716,7 @@ describe('JS control flow', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 3, + decls: 3, vars: 0, template: function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -772,7 +772,7 @@ describe('JS control flow', () => { static ngComponentDef = ɵɵdefineComponent({ type: Comp, selectors: [['comp']], - consts: 0, + decls: 0, vars: 0, template: function(rf: RenderFlags, ctx: Comp) {} }); @@ -786,7 +786,7 @@ describe('JS control flow', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 3, + decls: 3, vars: 0, template: function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/di_spec.ts b/packages/core/test/render3/di_spec.ts index 3b0922f8d06364..8a1968df757865 100644 --- a/packages/core/test/render3/di_spec.ts +++ b/packages/core/test/render3/di_spec.ts @@ -121,7 +121,7 @@ describe('di', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComp, selectors: [['my-comp']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: MyComp) { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/instructions_spec.ts b/packages/core/test/render3/instructions_spec.ts index aaf659a8d43376..527c6b4cfadb27 100644 --- a/packages/core/test/render3/instructions_spec.ts +++ b/packages/core/test/render3/instructions_spec.ts @@ -244,7 +244,7 @@ describe('instructions', () => { static ngComponentDef = ɵɵdefineComponent({ type: NestedLoops, selectors: [['nested-loops']], - consts: 1, + decls: 1, vars: 1, attrs: [[AttributeMarker.Template, 'ngFor', 'ngForOf']], template: function ToDoAppComponent_Template(rf: RenderFlags, ctx: NestedLoops) { @@ -488,6 +488,6 @@ function stripStyleWsCharacters(value: string): string { } function createTemplateFixtureWithSanitizer( - buildFn: () => any, consts: number, sanitizer: Sanitizer) { - return new TemplateFixture(buildFn, () => {}, consts, 0, null, null, sanitizer); + buildFn: () => any, decls: number, sanitizer: Sanitizer) { + return new TemplateFixture(buildFn, () => {}, decls, 0, null, null, sanitizer); } diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index 85ab1c0d86e3b0..b018fdbbab99c6 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -121,7 +121,7 @@ describe('render3 integration test', () => { static ngComponentDef = ɵɵdefineComponent({ selectors: [['child']], type: ChildComponent, - consts: 3, + decls: 3, vars: 0, template: function ChildComponentTemplate( rf: RenderFlags, ctx: {beforeTree: Tree, afterTree: Tree}) { @@ -203,7 +203,7 @@ describe('component styles', () => { static ngComponentDef = ɵɵdefineComponent({ type: StyledComp, styles: ['div { color: red; }'], - consts: 1, + decls: 1, vars: 0, encapsulation: 100, selectors: [['foo']], @@ -230,7 +230,7 @@ describe('component animations', () => { static ngFactoryDef = () => new AnimComp(); static ngComponentDef = ɵɵdefineComponent({ type: AnimComp, - consts: 0, + decls: 0, vars: 0, data: { animation: [ @@ -257,7 +257,7 @@ describe('component animations', () => { static ngFactoryDef = () => new AnimComp(); static ngComponentDef = ɵɵdefineComponent({ type: AnimComp, - consts: 0, + decls: 0, vars: 0, data: { animation: [], @@ -277,7 +277,7 @@ describe('component animations', () => { static ngFactoryDef = () => new AnimComp(); static ngComponentDef = ɵɵdefineComponent({ type: AnimComp, - consts: 1, + decls: 1, vars: 1, selectors: [['foo']], attrs: [[AttributeMarker.Bindings, '@fooAnimation']], @@ -314,7 +314,7 @@ describe('component animations', () => { static ngFactoryDef = () => new AnimComp(); static ngComponentDef = ɵɵdefineComponent({ type: AnimComp, - consts: 1, + decls: 1, vars: 1, selectors: [['foo']], attrs: [['@fooAnimation', '']], @@ -363,7 +363,7 @@ describe('component animations', () => { // static ngFactoryDef = () => new ParentComp(); // static ngComponentDef = ɵɵdefineComponent({ // type: ParentComp, - // consts: 1, + // decls: 1, // vars: 1, // selectors: [['foo']], // template: (rf: RenderFlags, ctx: ParentComp) => { @@ -394,7 +394,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -426,7 +426,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: ChildComp, selectors: [['child-comp']], - consts: 3, + decls: 3, vars: 0, template: (rf: RenderFlags, ctx: ChildComp) => { if (rf & RenderFlags.Create) { @@ -444,7 +444,7 @@ describe('element discovery', () => { type: ParentComp, selectors: [['parent-comp']], directives: [ChildComp], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: ParentComp) => { if (rf & RenderFlags.Create) { @@ -477,7 +477,7 @@ describe('element discovery', () => { type: StructuredComp, selectors: [['structured-comp']], directives: [NgIf], - consts: 2, + decls: 2, vars: 1, attrs: [['ngIf', '']], template: (rf: RenderFlags, ctx: StructuredComp) => { @@ -527,7 +527,7 @@ describe('element discovery', () => { type: StructuredComp, selectors: [['structured-comp']], directives: [NgIf], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -564,7 +564,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -596,7 +596,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -629,7 +629,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -677,7 +677,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: ProjectorComp, selectors: [['projector-comp']], - consts: 4, + decls: 4, vars: 0, template: (rf: RenderFlags, ctx: ProjectorComp) => { if (rf & RenderFlags.Create) { @@ -701,7 +701,7 @@ describe('element discovery', () => { type: ParentComp, selectors: [['parent-comp']], directives: [ProjectorComp], - consts: 5, + decls: 5, vars: 0, template: (rf: RenderFlags, ctx: ParentComp) => { if (rf & RenderFlags.Create) { @@ -774,7 +774,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => { if (rf & RenderFlags.Create) { @@ -801,7 +801,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: StructuredComp, selectors: [['structured-comp']], - consts: 0, + decls: 0, vars: 0, template: (rf: RenderFlags, ctx: StructuredComp) => {} }); @@ -859,7 +859,7 @@ describe('element discovery', () => { type: StructuredComp, selectors: [['structured-comp']], directives: [MyDir1, MyDir2, MyDir3], - consts: 2, + decls: 2, vars: 0, attrs: [['my-dir-1', '', 'my-dir-2', ''], ['my-dir-3']], template: (rf: RenderFlags, ctx: StructuredComp) => { @@ -936,7 +936,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: ChildComp, selectors: [['child-comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, ctx: ChildComp) => { if (rf & RenderFlags.Create) { @@ -952,7 +952,7 @@ describe('element discovery', () => { type: ParentComp, selectors: [['parent-comp']], directives: [ChildComp, MyDir1, MyDir2], - consts: 1, + decls: 1, vars: 0, attrs: [['my-dir-1', '', 'my-dir-2', '']], template: (rf: RenderFlags, ctx: ParentComp) => { @@ -1014,7 +1014,7 @@ describe('element discovery', () => { static ngComponentDef = ɵɵdefineComponent({ type: ChildComp, selectors: [['child-comp']], - consts: 3, + decls: 3, vars: 0, template: (rf: RenderFlags, ctx: ChildComp) => { if (rf & RenderFlags.Create) { @@ -1032,7 +1032,7 @@ describe('element discovery', () => { type: ParentComp, selectors: [['parent-comp']], directives: [ChildComp], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: ParentComp) => { if (rf & RenderFlags.Create) { @@ -1075,7 +1075,7 @@ describe('sanitization', () => { static ngComponentDef = ɵɵdefineComponent({ type: SanitizationComp, selectors: [['sanitize-this']], - consts: 1, + decls: 1, vars: 1, template: (rf: RenderFlags, ctx: SanitizationComp) => { if (rf & RenderFlags.Create) { @@ -1133,7 +1133,7 @@ describe('sanitization', () => { static ngComponentDef = ɵɵdefineComponent({ type: SimpleComp, selectors: [['sanitize-this']], - consts: 1, + decls: 1, vars: 0, attrs: [['unsafeUrlHostBindingDir', '']], template: (rf: RenderFlags, ctx: SimpleComp) => { diff --git a/packages/core/test/render3/lifecycle_spec.ts b/packages/core/test/render3/lifecycle_spec.ts index 012a141cac1004..9a394bd164675a 100644 --- a/packages/core/test/render3/lifecycle_spec.ts +++ b/packages/core/test/render3/lifecycle_spec.ts @@ -46,7 +46,7 @@ describe('lifecycles', () => { }, 1); function createOnInitComponent( - name: string, template: ComponentTemplate, consts: number, vars: number = 0, + name: string, template: ComponentTemplate, decls: number, vars: number = 0, directives: any[] = []) { return class Component { val: string = ''; @@ -59,7 +59,7 @@ describe('lifecycles', () => { static ngComponentDef = ɵɵdefineComponent({ type: Component, selectors: [[name]], - consts: consts, + decls: decls, vars: vars, inputs: {val: 'val'}, template, directives: directives diff --git a/packages/core/test/render3/listeners_spec.ts b/packages/core/test/render3/listeners_spec.ts index 2522a48ae69022..b5ac4b69c24c20 100644 --- a/packages/core/test/render3/listeners_spec.ts +++ b/packages/core/test/render3/listeners_spec.ts @@ -37,7 +37,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComp, selectors: [['comp']], - consts: 2, + decls: 2, vars: 0, /** */ template: function CompTemplate(rf: RenderFlags, ctx: any) { @@ -70,7 +70,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyCompWithGlobalListeners, selectors: [['comp']], - consts: 1, + decls: 1, vars: 0, template: function CompTemplate(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -138,7 +138,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: PreventDefaultComp, selectors: [['prevent-default-comp']], - consts: 2, + decls: 2, vars: 0, /** */ template: (rf: RenderFlags, ctx: PreventDefaultComp) => { @@ -329,7 +329,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComp, selectors: [['app-comp']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -390,7 +390,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComp, selectors: [['app-comp']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -454,7 +454,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComp, selectors: [['app-comp']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -533,7 +533,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComp, selectors: [['comp']], - consts: 1, + decls: 1, vars: 0, template: function CompTemplate(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -636,7 +636,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComp, selectors: [['comp']], - consts: 2, + decls: 2, vars: 0, /** */ template: function CompTemplate(rf: RenderFlags, ctx: any) { @@ -917,7 +917,7 @@ describe('event listeners', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 3, + decls: 3, vars: 0, template: (rf: RenderFlags, ctx: App) => { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/outputs_spec.ts b/packages/core/test/render3/outputs_spec.ts index c19be35330320a..6030bd73842e09 100644 --- a/packages/core/test/render3/outputs_spec.ts +++ b/packages/core/test/render3/outputs_spec.ts @@ -26,7 +26,7 @@ describe('outputs', () => { type: ButtonToggle, selectors: [['button-toggle']], template: function(rf: RenderFlags, ctx: any) {}, - consts: 0, + decls: 0, vars: 0, outputs: {change: 'change', resetStream: 'reset'} }); diff --git a/packages/core/test/render3/perf/setup.ts b/packages/core/test/render3/perf/setup.ts index 6d097405a5f5f4..8b3304425cd0c8 100644 --- a/packages/core/test/render3/perf/setup.ts +++ b/packages/core/test/render3/perf/setup.ts @@ -23,7 +23,7 @@ export function createAndRenderLView( } export function setupRootViewWithEmbeddedViews( - templateFn: ComponentTemplate| null, consts: number, vars: number, noOfViews: number, + templateFn: ComponentTemplate| null, decls: number, vars: number, noOfViews: number, embeddedViewContext: any = {}, attrs: TAttributes[] | null = null): LView { // Create a root view with a container const rootTView = createTView(-1, null, 1, 0, null, null, null, null, attrs); @@ -38,7 +38,7 @@ export function setupRootViewWithEmbeddedViews( // create test embedded views - const embeddedTView = createTView(-1, templateFn, consts, vars, null, null, null, null, null); + const embeddedTView = createTView(-1, templateFn, decls, vars, null, null, null, null, null); const viewTNode = createTNode(rootTView, null, TNodeType.View, -1, null, null) as TViewNode; // create embedded views and add them to the container diff --git a/packages/core/test/render3/providers_spec.ts b/packages/core/test/render3/providers_spec.ts index 82191cf827d758..7004d971d50749 100644 --- a/packages/core/test/render3/providers_spec.ts +++ b/packages/core/test/render3/providers_spec.ts @@ -873,7 +873,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: Repeated, selectors: [['repeated']], - consts: 2, + decls: 2, vars: 2, template: function(fs: RenderFlags, ctx: Repeated) { if (fs & RenderFlags.Create) { @@ -904,7 +904,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: ComponentWithProviders, selectors: [['component-with-providers']], - consts: 2, + decls: 2, vars: 0, template: function(fs: RenderFlags, ctx: ComponentWithProviders) { if (fs & RenderFlags.Create) { @@ -959,7 +959,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: Repeated, selectors: [['repeated']], - consts: 2, + decls: 2, vars: 2, template: function(fs: RenderFlags, ctx: Repeated) { if (fs & RenderFlags.Create) { @@ -993,7 +993,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: ComponentWithProviders, selectors: [['component-with-providers']], - consts: 2, + decls: 2, vars: 0, template: function(fs: RenderFlags, ctx: ComponentWithProviders) { if (fs & RenderFlags.Create) { @@ -1042,7 +1042,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: EmbeddedComponent, selectors: [['embedded-cmp']], - consts: 1, + decls: 1, vars: 1, template: (rf: RenderFlags, cmp: EmbeddedComponent) => { if (rf & RenderFlags.Create) { @@ -1065,7 +1065,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: HostComponent, selectors: [['host-cmp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, cmp: HostComponent) => { if (rf & RenderFlags.Create) { @@ -1089,7 +1089,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComponent, selectors: [['app-cmp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, cmp: AppComponent) => { if (rf & RenderFlags.Create) { @@ -1251,7 +1251,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComponent, selectors: [['my-cmp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, cmp: MyComponent) => { if (rf & RenderFlags.Create) { @@ -1278,7 +1278,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComponent, selectors: [['app-cmp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, cmp: AppComponent) => { if (rf & RenderFlags.Create) { @@ -1343,7 +1343,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: MyComponent, selectors: [['my-comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: RenderFlags, ctx: MyComponent) => { if (rf & RenderFlags.Create) { @@ -1370,7 +1370,7 @@ describe('providers', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app-cmp']], - consts: 2, + decls: 2, vars: 0, template: (rf: RenderFlags, ctx: App) => { if (rf & RenderFlags.Create) { @@ -1445,7 +1445,7 @@ function expectProvidersScenario(defs: { static ngComponentDef = ɵɵdefineComponent({ type: ViewChildComponent, selectors: [['view-child']], - consts: 1, + decls: 1, vars: 0, template: function(fs: RenderFlags, ctx: ViewChildComponent) { if (fs & RenderFlags.Create) { @@ -1473,7 +1473,7 @@ function expectProvidersScenario(defs: { static ngComponentDef = ɵɵdefineComponent({ type: ContentChildComponent, selectors: [['content-child']], - consts: 1, + decls: 1, vars: 0, template: function(fs: RenderFlags, ctx: ParentComponent) { if (fs & RenderFlags.Create) { @@ -1504,7 +1504,7 @@ function expectProvidersScenario(defs: { static ngComponentDef = ɵɵdefineComponent({ type: ParentComponent, selectors: [['parent']], - consts: 1, + decls: 1, vars: 0, template: function(fs: RenderFlags, ctx: ParentComponent) { if (fs & RenderFlags.Create) { @@ -1541,7 +1541,7 @@ function expectProvidersScenario(defs: { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 2, + decls: 2, vars: 0, template: function(fs: RenderFlags, ctx: App) { if (fs & RenderFlags.Create) { diff --git a/packages/core/test/render3/pure_function_spec.ts b/packages/core/test/render3/pure_function_spec.ts index 615f6f9a645b61..528f104cce1d4f 100644 --- a/packages/core/test/render3/pure_function_spec.ts +++ b/packages/core/test/render3/pure_function_spec.ts @@ -23,7 +23,7 @@ describe('object literals', () => { static ngComponentDef = ɵɵdefineComponent({ type: ObjectComp, selectors: [['object-comp']], - consts: 0, + decls: 0, vars: 1, template: function ObjectComp_Template() {}, inputs: {config: 'config'} diff --git a/packages/core/test/render3/query_spec.ts b/packages/core/test/render3/query_spec.ts index d9aee0f28b78b4..c8a2889ce309f0 100644 --- a/packages/core/test/render3/query_spec.ts +++ b/packages/core/test/render3/query_spec.ts @@ -252,7 +252,7 @@ describe('query', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 1, + decls: 1, vars: 0, attrs: [['myDir']], template: function App_Template(rf: RenderFlags, ctx: App) { @@ -298,7 +298,7 @@ describe('query', () => { static ngComponentDef = ɵɵdefineComponent({ type: App, selectors: [['app']], - consts: 1, + decls: 1, vars: 0, attrs: [['myDir']], template: function App_Template(rf: RenderFlags, ctx: App) { @@ -842,7 +842,7 @@ describe('query', () => { static ngComponentDef = ɵɵdefineComponent({ type: Child, selectors: [['child']], - consts: 0, + decls: 0, vars: 0, template: (rf: RenderFlags, ctx: Child) => {}, exportAs: ['child'] @@ -2045,7 +2045,7 @@ describe('query', () => { ɵɵelement(4, 'span', 4); } }, - consts: 5, + decls: 5, vars: 0, viewQuery: function(rf: RenderFlags, ctx: ViewQueryComponent) { let tmp: any; diff --git a/packages/core/test/render3/render_util.ts b/packages/core/test/render3/render_util.ts index 9d87f045aea381..c4529232802391 100644 --- a/packages/core/test/render3/render_util.ts +++ b/packages/core/test/render3/render_util.ts @@ -100,7 +100,7 @@ export class TemplateFixture extends BaseFixture { * `if (rf & RenderFlags.Update) { __here__ }`. */ constructor( - private createBlock: () => void, private updateBlock: () => void = noop, consts: number = 0, + private createBlock: () => void, private updateBlock: () => void = noop, decls: number = 0, private vars: number = 0, directives?: DirectiveTypesOrFactory|null, pipes?: PipeTypesOrFactory|null, sanitizer?: Sanitizer|null, rendererFactory?: RendererFactory3, private _attrs?: TAttributes[]) { @@ -119,7 +119,7 @@ export class TemplateFixture extends BaseFixture { this.updateBlock(); } }, - consts, vars, null !, this._rendererFactory, null, this._directiveDefs, this._pipeDefs, + decls, vars, null !, this._rendererFactory, null, this._directiveDefs, this._pipeDefs, sanitizer, this._attrs); } @@ -237,7 +237,7 @@ export function resetDOM() { * * @param hostNode Existing node to render into. * @param templateFn Template function with the instructions. - * @param consts The number of nodes, local refs, and pipes in this template + * @param decls The number of nodes, local refs, and pipes in this template * @param context to pass into the template. * @param providedRendererFactory renderer factory to use * @param host The host element node to use @@ -245,7 +245,7 @@ export function resetDOM() { * @param pipes Pipe defs that should be used for matching */ export function renderTemplate( - hostNode: RElement, templateFn: ComponentTemplate, consts: number, vars: number, context: T, + hostNode: RElement, templateFn: ComponentTemplate, decls: number, vars: number, context: T, providedRendererFactory: RendererFactory3, componentView: LView | null, directives?: DirectiveDefListOrFactory | null, pipes?: PipeDefListOrFactory | null, sanitizer?: Sanitizer | null, attrs?: TAttributes[]): LView { @@ -264,7 +264,7 @@ export function renderTemplate( selectors: [], type: Object, template: templateFn, - consts: consts, + decls: decls, vars: vars, attrs: attrs, }); @@ -287,12 +287,12 @@ export function renderTemplate( * @deprecated use `TemplateFixture` or `ComponentFixture` */ export function renderToHtml( - template: ComponentTemplate, ctx: any, consts: number = 0, vars: number = 0, + template: ComponentTemplate, ctx: any, decls: number = 0, vars: number = 0, directives?: DirectiveTypesOrFactory | null, pipes?: PipeTypesOrFactory | null, providedRendererFactory?: RendererFactory3 | null, keepNgReflect = false, attrs?: TAttributes[]) { hostView = renderTemplate( - containerEl, template, consts, vars, ctx, providedRendererFactory || testRendererFactory, + containerEl, template, decls, vars, ctx, providedRendererFactory || testRendererFactory, hostView, toDefs(directives, extractDirectiveDef), toDefs(pipes, extractPipeDef), null, attrs); return toHtml(containerEl, keepNgReflect); @@ -366,7 +366,7 @@ export function toHtml(componentOrElement: T | RElement, keepNgReflect = fals } export function createComponent( - name: string, template: ComponentTemplate, consts: number = 0, vars: number = 0, + name: string, template: ComponentTemplate, decls: number = 0, vars: number = 0, directives: DirectiveTypesOrFactory = [], pipes: PipeTypesOrFactory = [], viewQuery: ComponentTemplate| null = null, providers: Provider[] = [], viewProviders: Provider[] = [], hostBindings?: HostBindingsFunction, @@ -377,7 +377,7 @@ export function createComponent( static ngComponentDef = ɵɵdefineComponent({ type: Component, selectors: [[name]], - consts: consts, + decls: decls, vars: vars, template: template, viewQuery: viewQuery, diff --git a/packages/core/test/render3/renderer_factory_spec.ts b/packages/core/test/render3/renderer_factory_spec.ts index 3570ed6c6cacb2..d67c98703fc0f8 100644 --- a/packages/core/test/render3/renderer_factory_spec.ts +++ b/packages/core/test/render3/renderer_factory_spec.ts @@ -31,7 +31,7 @@ describe('renderer factory lifecycle', () => { type: SomeComponent, encapsulation: ViewEncapsulation.None, selectors: [['some-component']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: SomeComponent) { if (rf & RenderFlags.Create) { @@ -51,7 +51,7 @@ describe('renderer factory lifecycle', () => { type: SomeComponentWhichThrows, encapsulation: ViewEncapsulation.None, selectors: [['some-component-with-Error']], - consts: 0, + decls: 0, vars: 0, template: function(rf: RenderFlags, ctx: SomeComponentWhichThrows) { throw(new Error('SomeComponentWhichThrows threw')); @@ -155,7 +155,7 @@ describe('Renderer2 destruction hooks', () => { type: SimpleComponent, encapsulation: ViewEncapsulation.None, selectors: [['simple']], - consts: 1, + decls: 1, vars: 0, template: function(rf: RenderFlags, ctx: SimpleComponent) { if (rf & RenderFlags.Create) { diff --git a/packages/core/test/render3/view_container_ref_spec.ts b/packages/core/test/render3/view_container_ref_spec.ts index 49ffbf959efc91..b34adac42c95fc 100644 --- a/packages/core/test/render3/view_container_ref_spec.ts +++ b/packages/core/test/render3/view_container_ref_spec.ts @@ -106,7 +106,7 @@ describe('ViewContainerRef', () => { type: TestComponent, encapsulation: ViewEncapsulation.None, selectors: [['test-cmp']], - consts: 4, + decls: 4, vars: 0, attrs: [['testdir', '']], template: (rf: RenderFlags, cmp: TestComponent) => { @@ -178,7 +178,7 @@ describe('ViewContainerRef', () => { type: TestComponent, encapsulation: ViewEncapsulation.None, selectors: [['test-cmp']], - consts: 4, + decls: 4, vars: 0, attrs: [['testdir', '']], template: (rf: RenderFlags, cmp: TestComponent) => { @@ -250,7 +250,7 @@ describe('ViewContainerRef', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppComp, selectors: [['app-comp']], - consts: 0, + decls: 0, vars: 0, template: (rf: RenderFlags, cmp: AppComp) => {} }); @@ -266,7 +266,7 @@ describe('ViewContainerRef', () => { static ngComponentDef = ɵɵdefineComponent({ type: DynamicComp, selectors: [['dynamic-comp']], - consts: 0, + decls: 0, vars: 0, template: (rf: RenderFlags, cmp: DynamicComp) => {} }); @@ -371,7 +371,7 @@ describe('ViewContainerRef', () => { static ngComponentDef = ɵɵdefineComponent({ type: AppCmpt, selectors: [['app']], - consts: 0, + decls: 0, vars: 0, template: (rf: RenderFlags, cmp: AppCmpt) => {} }); @@ -439,7 +439,7 @@ describe('ViewContainerRef', () => { static ngComponentDef = ɵɵdefineComponent({ type: DynamicCompWithViewQueries, selectors: [['dynamic-cmpt-with-view-queries']], - consts: 2, + decls: 2, vars: 0, attrs: [['bar', '']], template: (rf: RenderFlags, ctx: DynamicCompWithViewQueries) => { @@ -488,7 +488,7 @@ describe('ViewContainerRef', () => { static ngComponentDef = ɵɵdefineComponent({ type: CompWithListenerThatDestroysItself, selectors: [['comp-with-listener-and-on-destroy']], - consts: 2, + decls: 2, vars: 0, /** */ template: function CompTemplate(rf: RenderFlags, ctx: any) { diff --git a/packages/core/test/test_bed_spec.ts b/packages/core/test/test_bed_spec.ts index 7d5786cc4d9504..1f93f6d83ecf08 100644 --- a/packages/core/test/test_bed_spec.ts +++ b/packages/core/test/test_bed_spec.ts @@ -507,7 +507,7 @@ describe('TestBed', () => { static ngComponentDef = defineComponent({ type: ComponentClass, selectors: [['comp']], - consts: 1, + decls: 1, vars: 0, template: (rf: any, ctx: any) => { if (rf & 1) {