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 a43ef0e09b..82b4379423 100644 --- a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts @@ -444,19 +444,17 @@ describe('compiler compliance', () => { $r3$.ɵɵallocHostVars(14); } if (rf & 2) { - $r3$.ɵɵcomponentHostSyntheticProperty(elIndex, "@expansionHeight", - $r3$.ɵɵbind( + $r3$.ɵɵupdateSyntheticHostBinding("@expansionHeight", $r3$.ɵɵpureFunction2(5, $_c1$, ctx.getExpandedState(), $r3$.ɵɵpureFunction2(2, $_c0$, ctx.collapsedHeight, ctx.expandedHeight) ) - ), null, true + , null, true ); - $r3$.ɵɵcomponentHostSyntheticProperty(elIndex, "@expansionWidth", - $r3$.ɵɵbind( + $r3$.ɵɵupdateSyntheticHostBinding("@expansionWidth", $r3$.ɵɵpureFunction2(11, $_c1$, ctx.getExpandedState(), $r3$.ɵɵpureFunction2(8, $_c2$, ctx.collapsedWidth, ctx.expandedWidth) ) - ), null, true + , null, true ); } }, 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 bb506bd473..8ac751f5f9 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 @@ -350,7 +350,7 @@ describe('compiler compliance: styling', () => { $r3$.ɵɵcomponentHostSyntheticListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler($event) { return ctx.onStart(); }); $r3$.ɵɵcomponentHostSyntheticListener("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler($event) { return ctx.onDone(); }); } if (rf & 2) { - $r3$.ɵɵcomponentHostSyntheticProperty(elIndex, "@myAnim", $r3$.ɵɵbind(ctx.myAnimState), null, true); + $r3$.ɵɵupdateSyntheticHostBinding("@myAnim", ctx.myAnimState, null, true); } } … diff --git a/packages/compiler/src/render3/r3_identifiers.ts b/packages/compiler/src/render3/r3_identifiers.ts index 6979c3e140..285bb4c7b0 100644 --- a/packages/compiler/src/render3/r3_identifiers.ts +++ b/packages/compiler/src/render3/r3_identifiers.ts @@ -33,8 +33,8 @@ export class Identifiers { static select: o.ExternalReference = {name: 'ɵɵselect', moduleName: CORE}; - static componentHostSyntheticProperty: - o.ExternalReference = {name: 'ɵɵcomponentHostSyntheticProperty', moduleName: CORE}; + static updateSyntheticHostBinding: + o.ExternalReference = {name: 'ɵɵupdateSyntheticHostBinding', moduleName: CORE}; static componentHostSyntheticListener: o.ExternalReference = {name: 'ɵɵcomponentHostSyntheticListener', moduleName: CORE}; diff --git a/packages/compiler/src/render3/view/compiler.ts b/packages/compiler/src/render3/view/compiler.ts index 175bee4458..5d6378730d 100644 --- a/packages/compiler/src/render3/view/compiler.ts +++ b/packages/compiler/src/render3/view/compiler.ts @@ -667,18 +667,7 @@ function createHostBindingsFunction( sanitizerFn = resolveSanitizationFn(securityContexts[0], isAttribute); } } - const isInstructionWithoutElementIndex = - instruction === R3.property || instruction === R3.attribute; - const instructionParams: o.Expression[] = isInstructionWithoutElementIndex ? - [ - o.literal(bindingName), - bindingExpr.currValExpr, - ] : - [ - elVarExp, - o.literal(bindingName), - o.importExpr(R3.bind).callFn([bindingExpr.currValExpr]), - ]; + const instructionParams = [o.literal(bindingName), bindingExpr.currValExpr]; if (sanitizerFn) { instructionParams.push(sanitizerFn); } @@ -783,7 +772,7 @@ function getBindingNameAndInstruction(binding: ParsedProperty): // host bindings that have a synthetic property (e.g. @foo) should always be rendered // in the context of the component and not the parent. Therefore there is a special // compatibility instruction available for this purpose. - instruction = R3.componentHostSyntheticProperty; + instruction = R3.updateSyntheticHostBinding; } else { instruction = R3.property; } diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index 23b3cfac9c..b23bc2c35f 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -120,7 +120,7 @@ export { ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, - ɵɵcomponentHostSyntheticProperty, + ɵɵupdateSyntheticHostBinding, ɵɵcomponentHostSyntheticListener, ɵɵprojectionDef, ɵɵreference, diff --git a/packages/core/src/render3/index.ts b/packages/core/src/render3/index.ts index 73b79f84fb..723982608a 100644 --- a/packages/core/src/render3/index.ts +++ b/packages/core/src/render3/index.ts @@ -39,7 +39,6 @@ export { ɵɵclassMap, ɵɵclassProp, ɵɵcomponentHostSyntheticListener, - ɵɵcomponentHostSyntheticProperty, ɵɵcontainer, ɵɵcontainerRefreshEnd, @@ -119,6 +118,8 @@ export { ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, + + ɵɵupdateSyntheticHostBinding, } from './instructions/all'; export {RenderFlags} from './interfaces/definition'; export {CssSelectorList, ProjectionSlots} from './interfaces/projection'; diff --git a/packages/core/src/render3/instructions/property.ts b/packages/core/src/render3/instructions/property.ts index 4a4b14ad91..8dd5d615e8 100644 --- a/packages/core/src/render3/instructions/property.ts +++ b/packages/core/src/render3/instructions/property.ts @@ -110,10 +110,12 @@ export function ɵɵelementProperty( * * @codeGenApi */ -export function ɵɵcomponentHostSyntheticProperty( - index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null, - nativeOnly?: boolean) { - if (value !== NO_CHANGE) { - elementPropertyInternal(index, propName, value, sanitizer, nativeOnly, loadComponentRenderer); +export function ɵɵupdateSyntheticHostBinding( + propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null, nativeOnly?: boolean) { + const index = getSelectedIndex(); + // TODO(benlesh): remove bind call here. + const bound = ɵɵbind(value); + if (bound !== NO_CHANGE) { + elementPropertyInternal(index, propName, bound, sanitizer, nativeOnly, loadComponentRenderer); } } diff --git a/packages/core/src/render3/jit/environment.ts b/packages/core/src/render3/jit/environment.ts index c48a3a02ae..d5180a3158 100644 --- a/packages/core/src/render3/jit/environment.ts +++ b/packages/core/src/render3/jit/environment.ts @@ -88,7 +88,7 @@ export const angularCoreEnv: {[name: string]: Function} = 'ɵɵload': r3.ɵɵload, 'ɵɵprojection': r3.ɵɵprojection, 'ɵɵelementProperty': r3.ɵɵelementProperty, - 'ɵɵcomponentHostSyntheticProperty': r3.ɵɵcomponentHostSyntheticProperty, + 'ɵɵupdateSyntheticHostBinding': r3.ɵɵupdateSyntheticHostBinding, 'ɵɵcomponentHostSyntheticListener': r3.ɵɵcomponentHostSyntheticListener, 'ɵɵpipeBind1': r3.ɵɵpipeBind1, 'ɵɵpipeBind2': r3.ɵɵpipeBind2, diff --git a/tools/public_api_guard/core/core.d.ts b/tools/public_api_guard/core/core.d.ts index f07ece41d6..80a2574b6b 100644 --- a/tools/public_api_guard/core/core.d.ts +++ b/tools/public_api_guard/core/core.d.ts @@ -712,8 +712,6 @@ export declare type ɵɵComponentDefWithMeta(eventName: string, listenerFn: (e?: any) => any, useCapture?: boolean, eventTargetResolver?: GlobalTargetResolver): void; -export declare function ɵɵcomponentHostSyntheticProperty(index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null, nativeOnly?: boolean): void; - export declare function ɵɵcontainer(index: number): void; export declare function ɵɵcontainerRefreshEnd(): void; @@ -1077,6 +1075,8 @@ export declare function ɵɵtextInterpolate8(prefix: string, v0: any, i0: string export declare function ɵɵtextInterpolateV(values: any[]): TsickleIssue1009; +export declare function ɵɵupdateSyntheticHostBinding(propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null, nativeOnly?: boolean): void; + export declare function ɵɵviewQuery(predicate: Type | string[], descend: boolean, read: any): QueryList; export declare const PACKAGE_ROOT_URL: InjectionToken;