refactor(core): move the data store operation out of instructions (#61425)

The view data store operation is not an instruction and shouldn't be
located in the instructions folder.

PR Close #61425
This commit is contained in:
Pawel Kozlowski
2025-05-16 17:15:19 +02:00
committed by Jessica Janiuk
parent bf99954390
commit 69984ef55d
5 changed files with 16 additions and 16 deletions
+2 -1
View File
@@ -52,7 +52,6 @@ export {ComponentFactory, ComponentFactoryResolver, ComponentRef} from './compon
export {ɵɵgetInheritedFactory} from './di';
export {getLocaleId, setLocaleId} from './i18n/i18n_locale_id';
export {
store,
ɵɵadvance,
ɵɵattribute,
ɵɵattributeInterpolate1,
@@ -230,6 +229,8 @@ export {ɵɵgetComponentDepsFactory} from './local_compilation';
export {ɵsetClassDebugInfo} from './debug/set_debug_info';
export {ɵɵreplaceMetadata} from './hmr';
export {store} from './util/view_utils';
export {
ComponentDef,
ComponentTemplate,
@@ -12,8 +12,7 @@ import {TNodeType} from '../interfaces/node';
import {HEADER_OFFSET} from '../interfaces/view';
import {getContextLView, getLView, getSelectedIndex, getTView, setCurrentTNode} from '../state';
import {getOrCreateTNode} from '../tnode_manipulation';
import {load} from '../util/view_utils';
import {store} from './storage';
import {load, store} from '../util/view_utils';
/** Object that indicates the value of a `@let` declaration that hasn't been initialized yet. */
const UNINITIALIZED_LET = {};
@@ -9,17 +9,6 @@ import {HEADER_OFFSET, LView, TView} from '../interfaces/view';
import {getContextLView} from '../state';
import {load} from '../util/view_utils';
/** Store a value in the `data` at a given `index`. */
export function store<T>(tView: TView, lView: LView, index: number, value: T): void {
// We don't store any static data for local variables, so the first time
// we see the template, we should store as null to avoid a sparse array
if (index >= tView.data.length) {
tView.data[index] = null;
tView.blueprint[index] = null;
}
lView[index] = value;
}
/**
* Retrieves a local reference from the current contextViewData.
*
+2 -2
View File
@@ -14,7 +14,7 @@ import {Type} from '../interface/type';
import {InjectorProfilerContext, setInjectorProfilerContext} from './debug/injector_profiler';
import {getFactoryDef} from './definition_factory';
import {NodeInjector, setIncludeViewProviders} from './di';
import {store, ɵɵdirectiveInject} from './instructions/all';
import {ɵɵdirectiveInject} from './instructions/all';
import {isHostComponentStandalone} from './instructions/element_validation';
import {PipeDef, PipeDefList} from './interfaces/definition';
import {TTextNode} from './interfaces/node';
@@ -27,7 +27,7 @@ import {
pureFunctionVInternal,
} from './pure_function';
import {getBindingRoot, getCurrentTNode, getLView, getTView} from './state';
import {load} from './util/view_utils';
import {load, store} from './util/view_utils';
/**
* Create a pipe.
@@ -138,6 +138,17 @@ export function load<T>(view: LView | TData, index: number): T {
return view[index];
}
/** Store a value in the `data` at a given `index`. */
export function store<T>(tView: TView, lView: LView, index: number, value: T): void {
// We don't store any static data for local variables, so the first time
// we see the template, we should store as null to avoid a sparse array
if (index >= tView.data.length) {
tView.data[index] = null;
tView.blueprint[index] = null;
}
lView[index] = value;
}
export function getComponentLViewByIndex(nodeIndex: number, hostView: LView): LView {
// Could be an LView or an LContainer. If LContainer, unwrap to find LView.
ngDevMode && assertIndexInRange(hostView, nodeIndex);