refactor(ivy): evaluate map-based styling bindings with a new algorithm (#30543)

This patch in the second runtime change which refactors how styling
bindings work in Angular. This patch refactors how map-based
`[style]` and `[class]` bindings work using a new algorithm which
is faster and less complex than the former one.

This patch is a follow-up to an earlier refactor which enabled
support for prop-based `[style.name]` and `[class.name]`
bindings (see f03475cac8).

PR Close #30543
This commit is contained in:
Matias Niemelä
2019-05-16 16:25:52 -07:00
parent deb77bd3df
commit dc6406e5e8
14 changed files with 1361 additions and 250 deletions

View File

@ -364,6 +364,11 @@ export class StylingBuilder {
private _buildMapBasedInstruction(
valueConverter: ValueConverter, isClassBased: boolean, stylingInput: BoundStylingEntry) {
let totalBindingSlotsRequired = 0;
if (compilerIsNewStylingInUse()) {
// the old implementation does not reserve slot values for
// binding entries. The new one does.
totalBindingSlotsRequired++;
}
// these values must be outside of the update block so that they can
// be evaluated (the AST visit call) during creation time so that any