refactor(ivy): remove global state access from inputs-related functions (#32370)
PR Close #32370
This commit is contained in:
parent
1bb9ce5d8c
commit
d4703d9316
@ -84,7 +84,7 @@ export function ɵɵelementStart(
|
|||||||
ngDevMode && ngDevMode.firstTemplatePass++;
|
ngDevMode && ngDevMode.firstTemplatePass++;
|
||||||
resolveDirectives(tView, lView, tNode, localRefs || null);
|
resolveDirectives(tView, lView, tNode, localRefs || null);
|
||||||
|
|
||||||
const inputData = initializeTNodeInputs(tNode);
|
const inputData = initializeTNodeInputs(tView, tNode);
|
||||||
if (inputData && inputData.hasOwnProperty('class')) {
|
if (inputData && inputData.hasOwnProperty('class')) {
|
||||||
tNode.flags |= TNodeFlags.hasClassInput;
|
tNode.flags |= TNodeFlags.hasClassInput;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ function listenerInternal(
|
|||||||
if (tNode.outputs === undefined) {
|
if (tNode.outputs === undefined) {
|
||||||
// if we create TNode here, inputs must be undefined so we know they still need to be
|
// if we create TNode here, inputs must be undefined so we know they still need to be
|
||||||
// checked
|
// checked
|
||||||
tNode.outputs = generatePropertyAliases(tNode, BindingDirection.Output);
|
tNode.outputs = generatePropertyAliases(tView, tNode, BindingDirection.Output);
|
||||||
}
|
}
|
||||||
|
|
||||||
const outputs = tNode.outputs;
|
const outputs = tNode.outputs;
|
||||||
|
@ -813,9 +813,8 @@ export function createTNode(
|
|||||||
* @param direction whether to consider inputs or outputs
|
* @param direction whether to consider inputs or outputs
|
||||||
* @returns PropertyAliases|null aggregate of all properties if any, `null` otherwise
|
* @returns PropertyAliases|null aggregate of all properties if any, `null` otherwise
|
||||||
*/
|
*/
|
||||||
export function generatePropertyAliases(tNode: TNode, direction: BindingDirection): PropertyAliases|
|
export function generatePropertyAliases(
|
||||||
null {
|
tView: TView, tNode: TNode, direction: BindingDirection): PropertyAliases|null {
|
||||||
const tView = getLView()[TVIEW];
|
|
||||||
let propStore: PropertyAliases|null = null;
|
let propStore: PropertyAliases|null = null;
|
||||||
const start = tNode.directiveStart;
|
const start = tNode.directiveStart;
|
||||||
const end = tNode.directiveEnd;
|
const end = tNode.directiveEnd;
|
||||||
@ -865,7 +864,7 @@ export function elementPropertyInternal<T>(
|
|||||||
const tNode = getTNode(index, lView);
|
const tNode = getTNode(index, lView);
|
||||||
let inputData: PropertyAliases|null|undefined;
|
let inputData: PropertyAliases|null|undefined;
|
||||||
let dataValue: PropertyAliasValue|undefined;
|
let dataValue: PropertyAliasValue|undefined;
|
||||||
if (!nativeOnly && (inputData = initializeTNodeInputs(tNode)) &&
|
if (!nativeOnly && (inputData = initializeTNodeInputs(lView[TVIEW], tNode)) &&
|
||||||
(dataValue = inputData[propName])) {
|
(dataValue = inputData[propName])) {
|
||||||
setInputsForProperty(lView, dataValue, value);
|
setInputsForProperty(lView, dataValue, value);
|
||||||
if (isComponent(tNode)) markDirtyIfOnPush(lView, index + HEADER_OFFSET);
|
if (isComponent(tNode)) markDirtyIfOnPush(lView, index + HEADER_OFFSET);
|
||||||
@ -1784,12 +1783,12 @@ export function storeBindingMetadata(lView: LView, prefix = '', suffix = ''): st
|
|||||||
|
|
||||||
export const CLEAN_PROMISE = _CLEAN_PROMISE;
|
export const CLEAN_PROMISE = _CLEAN_PROMISE;
|
||||||
|
|
||||||
export function initializeTNodeInputs(tNode: TNode): PropertyAliases|null {
|
export function initializeTNodeInputs(tView: TView, tNode: TNode): PropertyAliases|null {
|
||||||
// If tNode.inputs is undefined, a listener has created outputs, but inputs haven't
|
// If tNode.inputs is undefined, a listener has created outputs, but inputs haven't
|
||||||
// yet been checked.
|
// yet been checked.
|
||||||
if (tNode.inputs === undefined) {
|
if (tNode.inputs === undefined) {
|
||||||
// mark inputs as checked
|
// mark inputs as checked
|
||||||
tNode.inputs = generatePropertyAliases(tNode, BindingDirection.Input);
|
tNode.inputs = generatePropertyAliases(tView, tNode, BindingDirection.Input);
|
||||||
}
|
}
|
||||||
return tNode.inputs;
|
return tNode.inputs;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user