Skip to content

Commit

Permalink
refactor(ivy): use generated consts value to set binding index (#25533)
Browse files Browse the repository at this point in the history
PR Close #25533
  • Loading branch information
kara authored and jasonaden committed Aug 17, 2018
1 parent 4708cb9 commit f2aa9c6
Show file tree
Hide file tree
Showing 52 changed files with 2,296 additions and 1,767 deletions.
5 changes: 3 additions & 2 deletions modules/benchmarks/src/largetable/render3/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class LargeTableComponent {
static ngComponentDef: ComponentDefInternal<LargeTableComponent> = ɵdefineComponent({
type: LargeTableComponent,
selectors: [['largetable']],
consts: 3,
template: function(rf: ɵRenderFlags, ctx: LargeTableComponent) {
if (rf & ɵRenderFlags.Create) {
ɵelementStart(0, 'table');
Expand All @@ -33,7 +34,7 @@ export class LargeTableComponent {
ɵcontainerRefreshStart(2);
{
for (let row of ctx.data) {
let rf1 = ɵembeddedViewStart(1);
let rf1 = ɵembeddedViewStart(1, 2);
{
if (rf1 & ɵRenderFlags.Create) {
ɵelementStart(0, 'tr');
Expand All @@ -44,7 +45,7 @@ export class LargeTableComponent {
ɵcontainerRefreshStart(1);
{
for (let cell of row) {
let rf2 = ɵembeddedViewStart(2);
let rf2 = ɵembeddedViewStart(2, 2);
{
if (rf2 & ɵRenderFlags.Create) {
ɵelementStart(0, 'td');
Expand Down
10 changes: 6 additions & 4 deletions modules/benchmarks/src/tree/render3/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class TreeComponent {
static ngComponentDef = ɵdefineComponent({
type: TreeComponent,
selectors: [['tree']],
consts: 4,
template: function(rf: ɵRenderFlags, ctx: TreeComponent) {
if (rf & ɵRenderFlags.Create) {
ɵelementStart(0, 'span');
Expand All @@ -53,7 +54,7 @@ export class TreeComponent {
ɵcontainerRefreshStart(2);
{
if (ctx.data.left != null) {
let rf0 = ɵembeddedViewStart(0);
let rf0 = ɵembeddedViewStart(0, 1);
{
if (rf0 & ɵRenderFlags.Create) {
ɵelementStart(0, 'tree');
Expand All @@ -70,7 +71,7 @@ export class TreeComponent {
ɵcontainerRefreshStart(3);
{
if (ctx.data.right != null) {
let rf0 = ɵembeddedViewStart(0);
let rf0 = ɵembeddedViewStart(0, 1);
{
if (rf0 & ɵRenderFlags.Create) {
ɵelementStart(0, 'tree');
Expand Down Expand Up @@ -99,6 +100,7 @@ export class TreeFunction {
static ngComponentDef = ɵdefineComponent({
type: TreeFunction,
selectors: [['tree']],
consts: 5,
template: function(rf: ɵRenderFlags, ctx: TreeFunction) {
// bit of a hack
TreeTpl(rf, ctx.data);
Expand Down Expand Up @@ -128,7 +130,7 @@ export function TreeTpl(rf: ɵRenderFlags, ctx: TreeNode) {
ɵcontainerRefreshStart(3);
{
if (ctx.left != null) {
let rf0 = ɵembeddedViewStart(0);
let rf0 = ɵembeddedViewStart(0, 5);
{ TreeTpl(rf0, ctx.left); }
ɵembeddedViewEnd();
}
Expand All @@ -137,7 +139,7 @@ export function TreeTpl(rf: ɵRenderFlags, ctx: TreeNode) {
ɵcontainerRefreshStart(4);
{
if (ctx.right != null) {
let rf0 = ɵembeddedViewStart(0);
let rf0 = ɵembeddedViewStart(0, 5);
{ TreeTpl(rf0, ctx.right); }
ɵembeddedViewEnd();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ describe('compiler compliance', () => {
return new (t || MyComponent)();
},
features: [$r3$.ɵPublicFeature],
consts: 1,
template:function MyComponent_Template(rf,ctx){
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
Expand Down Expand Up @@ -467,6 +468,7 @@ describe('compiler compliance', () => {
selectors: [["child"]],
factory: function ChildComponent_Factory(t) { return new (t || ChildComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function ChildComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵtext(0, "child-view");
Expand All @@ -493,6 +495,7 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "child", $c1$);
Expand Down Expand Up @@ -645,10 +648,11 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 3,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "ul", null, $c1$);
$r3$.ɵtemplate(2, MyComponent_li_Template_2, null, $c2$);
$r3$.ɵtemplate(2, MyComponent_li_Template_2, 2, null, $c2$);
$r3$.ɵelementEnd();
}
},
Expand Down Expand Up @@ -705,6 +709,7 @@ describe('compiler compliance', () => {
selectors: [["my-app"]],
factory: function MyApp_Factory(t) { return new (t || MyApp)(); },
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyApp_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "my-comp");
Expand Down Expand Up @@ -785,6 +790,7 @@ describe('compiler compliance', () => {
selectors: [["my-app"]],
factory: function MyApp_Factory(t) { return new (t || MyApp)(); },
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyApp_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "my-comp");
Expand Down Expand Up @@ -847,6 +853,7 @@ describe('compiler compliance', () => {
selectors: [["my-app"]],
factory: function MyApp_Factory(t) { return new (t || MyApp)(); },
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyApp_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "object-comp");
Expand Down Expand Up @@ -913,6 +920,7 @@ describe('compiler compliance', () => {
selectors: [["my-app"]],
factory: function MyApp_Factory(t) { return new (t || MyApp)(); },
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyApp_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "nested-comp");
Expand Down Expand Up @@ -971,6 +979,7 @@ describe('compiler compliance', () => {
selectors: [["simple"]],
factory: function SimpleComponent_Factory(t) { return new (t || SimpleComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function SimpleComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵprojectionDef();
Expand All @@ -992,6 +1001,7 @@ describe('compiler compliance', () => {
selectors: [["complex"]],
factory: function ComplexComponent_Factory(t) { return new (t || ComplexComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 4,
template: function ComplexComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵprojectionDef($c1$, $c2$);
Expand Down Expand Up @@ -1067,6 +1077,7 @@ describe('compiler compliance', () => {
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵload(0))) && (ctx.someDir = $tmp$.first));
}
},
consts: 2,
template: function ViewQueryComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(1, "div", $e0_attrs$);
Expand Down Expand Up @@ -1134,6 +1145,7 @@ describe('compiler compliance', () => {
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 1)))) && ($instance$.someDirList = $tmp$));
},
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function ContentQueryComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵprojectionDef();
Expand Down Expand Up @@ -1219,6 +1231,7 @@ describe('compiler compliance', () => {
selectors: [["my-app"]],
factory: function MyApp_Factory(t) { return new (t || MyApp)(); },
features: [$r3$.ɵPublicFeature],
consts: 6,
template: function MyApp_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵtext(0);
Expand Down Expand Up @@ -1270,6 +1283,7 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 3,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "input", null, $c1$);
Expand Down Expand Up @@ -1345,7 +1359,7 @@ describe('compiler compliance', () => {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵtext(1);
$r3$.ɵtemplate(2, MyComponent_div_span_Template_2, null, $c2$);
$r3$.ɵtemplate(2, MyComponent_div_span_Template_2, 2, null, $c2$);
$r3$.ɵelement(3, "span", null, $c4$);
$r3$.ɵelementEnd();
}
Expand All @@ -1362,11 +1376,12 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 6,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "div", null, $c1$);
$r3$.ɵtext(2);
$r3$.ɵtemplate(3, MyComponent_div_Template_3, null, $c2$);
$r3$.ɵtemplate(3, MyComponent_div_Template_3, 5, null, $c2$);
$r3$.ɵelement(4, "div", null, $c3$);
}
if (rf & 2) {
Expand Down Expand Up @@ -1430,7 +1445,7 @@ describe('compiler compliance', () => {
if (rf & 1) {
$i0$.ɵelementStart(0, "div");
$i0$.ɵelement(1, "div", null, $c1$);
$i0$.ɵtemplate(3, MyComponent_div_span_Template_3, null, $c2$);
$i0$.ɵtemplate(3, MyComponent_div_span_Template_3, 2, null, $c2$);
$i0$.ɵelementEnd();
}
if (rf & 2) {
Expand All @@ -1442,7 +1457,7 @@ describe('compiler compliance', () => {
// ...
template:function MyComponent_Template(rf, ctx){
if (rf & 1) {
$i0$.ɵtemplate(0, MyComponent_div_Template_0, null, $c0$);
$i0$.ɵtemplate(0, MyComponent_div_Template_0, 4, null, $c0$);
}
if (rf & 2) {
$i0$.ɵelementProperty(0, "ngForOf", $i0$.ɵbind(ctx.items));
Expand Down Expand Up @@ -1506,6 +1521,7 @@ describe('compiler compliance', () => {
factory: function LifecycleComp_Factory(t) { return new (t || LifecycleComp)(); },
inputs: {nameMin: "name"},
features: [$r3$.ɵPublicFeature, $r3$.ɵNgOnChangesFeature],
consts: 0,
template: function LifecycleComp_Template(rf, ctx) {}
});`;

Expand All @@ -1515,6 +1531,7 @@ describe('compiler compliance', () => {
selectors: [["simple-layout"]],
factory: function SimpleLayout_Factory(t) { return new (t || SimpleLayout)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function SimpleLayout_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "lifecycle-comp");
Expand Down Expand Up @@ -1643,11 +1660,12 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function MyComponent_Template(rf, ctx){
if (rf & 1) {
$r3$.ɵnamespaceSVG();
$r3$.ɵelementStart(0,"svg");
$r3$.ɵtemplate(1,MyComponent__svg_g_Template_1,null,$_c0$);
$r3$.ɵtemplate(1, MyComponent__svg_g_Template_1, 2, null, $_c0$);
$r3$.ɵelementEnd();
}
if (rf & 2) { $r3$.ɵelementProperty(1,"forOf",$r3$.ɵbind(ctx.items)); }
Expand Down Expand Up @@ -1720,10 +1738,11 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "ul");
$r3$.ɵtemplate(1, MyComponent_li_Template_1, null, $_c0$);
$r3$.ɵtemplate(1, MyComponent_li_Template_1, 2, null, $_c0$);
$r3$.ɵelementEnd();
}
if (rf & 2) {
Expand Down Expand Up @@ -1801,7 +1820,7 @@ describe('compiler compliance', () => {
$r3$.ɵtext(2);
$r3$.ɵelementEnd();
$r3$.ɵelementStart(3, "ul");
$r3$.ɵtemplate(4, MyComponent_li_li_Template_4, null, $c1$);
$r3$.ɵtemplate(4, MyComponent_li_li_Template_4, 2, null, $c1$);
$r3$.ɵelementEnd();
$r3$.ɵelementEnd();
}
Expand All @@ -1818,10 +1837,11 @@ describe('compiler compliance', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 2,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "ul");
$r3$.ɵtemplate(1, MyComponent_li_Template_1, null, $c1$);
$r3$.ɵtemplate(1, MyComponent_li_Template_1, 5, null, $c1$);
$r3$.ɵelementEnd();
}
if (rf & 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('compiler compliance: listen()', () => {
// ...
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵtemplate(0, MyComponent_div_Template_0, null, $c0$);
$r3$.ɵtemplate(0, MyComponent_div_Template_0, 3, null, $c0$);
}
if (rf & 2) {
$i0$.ɵelementProperty(0, "ngIf", $i0$.ɵbind(ctx.showing));
Expand Down Expand Up @@ -154,6 +154,7 @@ describe('compiler compliance: listen()', () => {
selectors: [["my-component"]],
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
features: [$r3$.ɵPublicFeature],
consts: 4,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "button");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ describe('compiler compliance: styling', () => {
return new (t || MyComponent)();
},
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyComponent_Template(rf, $ctx$) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
Expand Down Expand Up @@ -151,6 +152,7 @@ describe('compiler compliance: styling', () => {
return new (t || MyComponent)();
},
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
Expand Down Expand Up @@ -246,6 +248,7 @@ describe('compiler compliance: styling', () => {
return new (t || MyComponent)();
},
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyComponent_Template(rf, $ctx$) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
Expand Down Expand Up @@ -300,6 +303,7 @@ describe('compiler compliance: styling', () => {
return new (t || MyComponent)();
},
features: [$r3$.ɵPublicFeature],
consts: 1,
template: function MyComponent_Template(rf, $ctx$) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
Expand Down
Loading

0 comments on commit f2aa9c6

Please sign in to comment.