refactor(ivy): add ɵɵupdateSyntheticHostBinding command (#30670)

- Refactors `ɵɵcomponentHostSyntheticProperty` into `ɵɵupdateSyntheticHostBinding`, to better align it with other new instructions.

PR Close #30670
This commit is contained in:
Ben Lesh
2019-05-24 17:21:41 -07:00
committed by Misko Hevery
parent 680d38513b
commit b4e68025f8
9 changed files with 22 additions and 32 deletions

View File

@ -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};

View File

@ -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;
}