perf(ivy): read selected index only when need in prop bindings (#32212)

PR Close #32212
This commit is contained in:
Pawel Kozlowski 2019-08-19 16:18:15 +02:00 committed by Andrew Kushnir
parent 10629600c5
commit 53f33c1cec
1 changed files with 1 additions and 4 deletions

View File

@ -5,7 +5,6 @@
* Use of this source code is governed by an MIT-style license that can be * Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {assertNotEqual} from '../../util/assert';
import {bindingUpdated} from '../bindings'; import {bindingUpdated} from '../bindings';
import {SanitizerFn} from '../interfaces/sanitization'; import {SanitizerFn} from '../interfaces/sanitization';
import {BINDING_INDEX, LView} from '../interfaces/view'; import {BINDING_INDEX, LView} from '../interfaces/view';
@ -35,12 +34,10 @@ import {TsickleIssue1009, elementPropertyInternal, storeBindingMetadata} from '.
*/ */
export function ɵɵproperty<T>( export function ɵɵproperty<T>(
propName: string, value: T, sanitizer?: SanitizerFn | null): TsickleIssue1009 { propName: string, value: T, sanitizer?: SanitizerFn | null): TsickleIssue1009 {
const index = getSelectedIndex();
ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1');
const lView = getLView(); const lView = getLView();
const bindReconciledValue = bind(lView, value); const bindReconciledValue = bind(lView, value);
if (bindReconciledValue !== NO_CHANGE) { if (bindReconciledValue !== NO_CHANGE) {
elementPropertyInternal(index, propName, bindReconciledValue, sanitizer); elementPropertyInternal(getSelectedIndex(), propName, bindReconciledValue, sanitizer);
} }
return ɵɵproperty; return ɵɵproperty;
} }