perf(ivy): remove unused argument in hostBindings function (#34969)

We had some logic for generating and passing in the `elIndex` parameter into the `hostBindings` function, but it wasn't actually being used for anything. The only place left that had a reference to it was the `StylingBuilder` and it only stored it without referencing it again.

PR Close #34969
This commit is contained in:
Kristiyan Kostadinov
2020-01-25 12:38:42 +01:00
committed by Andrew Kushnir
parent 7069a83727
commit 304584c291
13 changed files with 54 additions and 66 deletions

View File

@ -432,7 +432,7 @@ describe('compiler compliance', () => {
const $_c2$ = function (a0, a1) { return { collapsedWidth: a0, expandedWidth: a1 }; };
hostVars: 14,
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵupdateSyntheticHostBinding("@expansionHeight",
$r3$.ɵɵpureFunction2(5, $_c1$, ctx.getExpandedState(),
@ -3498,7 +3498,7 @@ describe('compiler compliance', () => {
BaseClass.ɵdir = $r3$.ɵɵdefineDirective({
type: BaseClass,
hostVars: 1,
hostBindings: function BaseClass_HostBindings(rf, ctx, elIndex) {
hostBindings: function BaseClass_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵattribute("tabindex", ctx.tabindex);
}
@ -3538,7 +3538,7 @@ describe('compiler compliance', () => {
// ...
BaseClass.ɵdir = $r3$.ɵɵdefineDirective({
type: BaseClass,
hostBindings: function BaseClass_HostBindings(rf, ctx, elIndex) {
hostBindings: function BaseClass_HostBindings(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵlistener("mousedown", function BaseClass_mousedown_HostBindingHandler($event) {
return ctx.handleMousedown($event);

View File

@ -672,7 +672,7 @@ describe('compiler compliance: bindings', () => {
type: HostBindingDir,
selectors: [["", "hostBindingDir", ""]],
hostVars: 1,
hostBindings: function HostBindingDir_HostBindings(rf, ctx, elIndex) {
hostBindings: function HostBindingDir_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("id", ctx.dirId);
}
@ -716,7 +716,7 @@ describe('compiler compliance: bindings', () => {
type: HostBindingComp,
selectors: [["host-binding-comp"]],
hostVars: 3,
hostBindings: function HostBindingComp_HostBindings(rf, ctx, elIndex) {
hostBindings: function HostBindingComp_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("id", $r3$.ɵɵpureFunction1(1, $ff$, ctx.id));
}
@ -761,7 +761,7 @@ describe('compiler compliance: bindings', () => {
type: HostAttributeDir,
selectors: [["", "hostAttributeDir", ""]],
hostVars: 1,
hostBindings: function HostAttributeDir_HostBindings(rf, ctx, elIndex) {
hostBindings: function HostAttributeDir_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵattribute("required", ctx.required);
}
@ -857,7 +857,7 @@ describe('compiler compliance: bindings', () => {
selectors: [["", "hostAttributeDir", ""]],
hostAttrs: ["title", "hello there from directive", ${AttributeMarker.Classes}, "one", "two", ${AttributeMarker.Styles}, "width", "200px", "height", "500px"],
hostVars: 4,
hostBindings: function HostAttributeDir_HostBindings(rf, ctx, elIndex) {
hostBindings: function HostAttributeDir_HostBindings(rf, ctx) {
}
`;
@ -891,7 +891,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("title", ctx.myTitle)("tabindex", 1)("id", ctx.myId);
@ -927,7 +927,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("tabindex", 1)("title", ctx.myTitle)("id", ctx.myId);
@ -959,7 +959,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("title", "my title")("id", "my-id");
@ -995,7 +995,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵupdateSyntheticHostBinding("@expand", ctx.expandedState)("@fadeOut", true)("@shrink", ctx.isSmall);
@ -1030,7 +1030,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵattribute("title", ctx.myTitle)("tabindex", 1)("id", ctx.myId);
@ -1066,7 +1066,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵattribute("tabindex", 1)("title", ctx.myTitle)("id", ctx.myId);
@ -1098,7 +1098,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("tabindex", 1);
@ -1136,7 +1136,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDirective_HostBindings(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵlistener("mousedown", function MyDirective_mousedown_HostBindingHandler($event) { return ctx.mousedown(); })("mouseup", function MyDirective_mouseup_HostBindingHandler($event) { return ctx.mouseup(); })("click", function MyDirective_click_HostBindingHandler($event) { return ctx.click(); });
}
@ -1169,7 +1169,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵcomponentHostSyntheticListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler($event) { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler($event) { return ctx.start(); });
}
@ -1207,7 +1207,7 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
const template = `
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵcomponentHostSyntheticListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler($event) { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler($event) { return ctx.start(); });
$r3$.ɵɵlistener("mousedown", function MyComponent_mousedown_HostBindingHandler($event) { return ctx.mousedown(); })("mouseup", function MyComponent_mouseup_HostBindingHandler($event) { return ctx.mouseup(); })("click", function MyComponent_click_HostBindingHandler($event) { return ctx.click(); });

View File

@ -334,7 +334,7 @@ describe('compiler compliance: styling', () => {
MyAnimDir.ɵdir = $r3$.ɵɵdefineDirective({
hostVars: 1,
hostBindings: function MyAnimDir_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyAnimDir_HostBindings(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵcomponentHostSyntheticListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler($event) { return ctx.onStart(); })("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler($event) { return ctx.onDone(); });
} if (rf & 2) {
@ -1007,7 +1007,7 @@ describe('compiler compliance: styling', () => {
const template = `
hostAttrs: [${AttributeMarker.Classes}, "foo", "baz", ${AttributeMarker.Styles}, "width", "200px", "height", "500px"],
hostVars: 8,
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵstyleMap(ctx.myStyle, $r3$.ɵɵdefaultStyleSanitizer);
$r3$.ɵɵclassMap(ctx.myClass);
@ -1062,7 +1062,7 @@ describe('compiler compliance: styling', () => {
const template = `
hostVars: 12,
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵstyleMap(ctx.myStyle, $r3$.ɵɵdefaultStyleSanitizer);
$r3$.ɵɵclassMap(ctx.myClasses);
@ -1131,7 +1131,7 @@ describe('compiler compliance: styling', () => {
const hostBindings = `
hostVars: 8,
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵstyleMap(ctx.myStyleExp, $r3$.ɵɵdefaultStyleSanitizer);
$r3$.ɵɵclassMap(ctx.myClassExp);
@ -1195,14 +1195,14 @@ describe('compiler compliance: styling', () => {
const template = `
hostVars: 2,
hostBindings: function ClassDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function ClassDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵclassMap(ctx.myClassMap);
}
}
hostVars: 4,
hostBindings: function WidthDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function WidthDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵstyleProp("width", ctx.myWidth);
$r3$.ɵɵclassProp("foo", ctx.myFooClass);
@ -1210,7 +1210,7 @@ describe('compiler compliance: styling', () => {
}
hostVars: 4,
hostBindings: function HeightDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function HeightDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵstyleProp("height", ctx.myHeight);
$r3$.ɵɵclassProp("bar", ctx.myBarClass);
@ -1804,7 +1804,7 @@ describe('compiler compliance: styling', () => {
MyComponent.ɵcmp = $r3$.ɵɵdefineComponent({
hostBindings: function MyComponent_HostBindings(rf, $ctx$, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, $ctx$) {
if (rf & 2) {
$r3$.ɵɵstyleProp("color", $ctx$.color)("transition", $ctx$.transition)("border", $ctx$.border);
@ -1861,7 +1861,7 @@ describe('compiler compliance: styling', () => {
const template = `
hostAttrs: ["title", "foo title", ${AttributeMarker.Classes}, "foo", "baz", ${AttributeMarker.Styles}, "width", "200px", "height", "500px"],
hostVars: 6,
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyComponent_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("id", ctx.id)("title", ctx.title);
$r3$.ɵɵstyleMap(ctx.myStyle, $r3$.ɵɵdefaultStyleSanitizer);
@ -1900,7 +1900,7 @@ describe('compiler compliance: styling', () => {
const template = `
hostVars: 6,
hostBindings: function WidthDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function WidthDirective_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("id", ctx.id)("title", ctx.title);
$r3$.ɵɵstyleProp("width", ctx.myWidth);
@ -2062,7 +2062,7 @@ describe('compiler compliance: styling', () => {
const template = `
hostVars: 10,
hostBindings: function MyDir_HostBindings(rf, ctx, elIndex) {
hostBindings: function MyDir_HostBindings(rf, ctx) {
if (rf & 2) {
$r3$.ɵɵhostProperty("title", ctx.title);
$r3$.ɵɵupdateSyntheticHostBinding("@anim",

View File

@ -2210,7 +2210,7 @@ runInEachFileSystem(os => {
env.driveMain();
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
hostBindings: function FooCmp_HostBindings(rf, ctx) {
if (rf & 1) {
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick(); })("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onDocumentClick($event.target); }, false, i0.ɵɵresolveDocument)("scroll", function FooCmp_scroll_HostBindingHandler($event) { return ctx.onWindowScroll(); }, false, i0.ɵɵresolveWindow);
}
@ -2341,7 +2341,7 @@ runInEachFileSystem(os => {
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostVars: 4,
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
hostBindings: function FooCmp_HostBindings(rf, ctx) {
if (rf & 1) {
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick($event); })("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onBodyClick($event); }, false, i0.ɵɵresolveBody)("change", function FooCmp_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg1, ctx.arg2, ctx.arg3); });
}
@ -2419,7 +2419,7 @@ runInEachFileSystem(os => {
env.driveMain();
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostBindings: function Dir_HostBindings(rf, ctx, elIndex) {
hostBindings: function Dir_HostBindings(rf, ctx) {
if (rf & 1) {
i0.ɵɵlistener("change", function Dir_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg); });
}
@ -4311,7 +4311,7 @@ runInEachFileSystem(os => {
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostVars: 6,
hostBindings: function UnsafeAttrsDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function UnsafeAttrsDirective_HostBindings(rf, ctx) {
if (rf & 2) {
i0.ɵɵattribute("href", ctx.attrHref, i0.ɵɵsanitizeUrlOrResourceUrl)("src", ctx.attrSrc, i0.ɵɵsanitizeUrlOrResourceUrl)("action", ctx.attrAction, i0.ɵɵsanitizeUrl)("profile", ctx.attrProfile, i0.ɵɵsanitizeResourceUrl)("innerHTML", ctx.attrInnerHTML, i0.ɵɵsanitizeHtml)("title", ctx.attrSafeTitle);
}
@ -4359,7 +4359,7 @@ runInEachFileSystem(os => {
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostVars: 6,
hostBindings: function UnsafePropsDirective_HostBindings(rf, ctx, elIndex) {
hostBindings: function UnsafePropsDirective_HostBindings(rf, ctx) {
if (rf & 2) {
i0.ɵɵhostProperty("href", ctx.propHref, i0.ɵɵsanitizeUrlOrResourceUrl)("src", ctx.propSrc, i0.ɵɵsanitizeUrlOrResourceUrl)("action", ctx.propAction, i0.ɵɵsanitizeUrl)("profile", ctx.propProfile, i0.ɵɵsanitizeResourceUrl)("innerHTML", ctx.propInnerHTML, i0.ɵɵsanitizeHtml)("title", ctx.propSafeTitle);
}
@ -4392,7 +4392,7 @@ runInEachFileSystem(os => {
const jsContents = env.getContents('test.js');
const hostBindingsFn = `
hostVars: 6,
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
hostBindings: function FooCmp_HostBindings(rf, ctx) {
if (rf & 2) {
i0.ɵɵhostProperty("src", ctx.srcProp)("href", ctx.hrefProp)("title", ctx.titleProp);
i0.ɵɵattribute("src", ctx.srcAttr)("href", ctx.hrefAttr)("title", ctx.titleAttr);