8000 Runtime refactor: move code out of instructions folder by pkozlowski-opensource · Pull Request #61425 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

Runtime refactor: move code out of instructions folder #61425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/hydration/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {inject, Injector} from '../di';
import {isRootTemplateMessage} from '../render3/i18n/i18n_util';
import {createIcuIterator} from '../render3/instructions/i18n_icu_container_visitor';
import {createIcuIterator} from '../render3/i18n/i18n_icu_container_visitor';
import {I18nNode, I18nNodeKind, I18nPlaceholderType, TI18n, TIcu} from '../render3/interfaces/i18n';
import {isTNodeShape, TNode, TNodeType} from '../render3/interfaces/node';
import type {Renderer} from '../render3/interfaces/renderer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {assertDomNode, assertNumber, assertNumberInRange} from '../../util/assert';
import {EMPTY_ARRAY} from '../../util/empty';
import {assertTIcu, assertTNodeForLView} from '../assert';
import {getCurrentICUCaseIndex} from '../i18n/i18n_util';
import {getCurrentICUCaseIndex} from './i18n_util';
import {I18nRemoveOpCodes, TIcu} from '../interfaces/i18n';
import {TIcuContainerNode} from '../interfaces/node';
import {RNode} from '../interfaces/renderer_dom';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/render3/i18n/i18n_parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
assertString,
} from '../../util/assert';
import {CharCode} from '../../util/char_code';
import {loadIcuContainerVisitor} from '../instructions/i18n_icu_container_visitor';
import {loadIcuContainerVisitor} from './i18n_icu_container_visitor';

import {getDocument} from '../interfaces/document';
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/render3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/render3/instructions/let_declaration.ts
Original file line number Diff line number Diff line change
< 8000 a href="#diff-21667fd9d30a26c8c3fedcaf5eb121037c2199274b8c4fbd044f39c2f24c131f" id="expand-up-link-0-diff-21667fd9d30a26c8c3fedcaf5eb121037c2199274b8c4fbd044f39c2f24c131f" class="js-expand directional-expander single-expander" aria-label="Expand Up" data-url="/angular/angular/blob_excerpt/c821225a30dce313dd52174631bb3a3a654204a5?context=pull_request&diff=unified&direction=up&in_wiki_context&last_left&last_right&left=12&left_hunk_size=8&mode=100644&path=packages%2Fcore%2Fsrc%2Frender3%2Finstructions%2Flet_declaration.ts&pull_request_id=2524796921&right=12&right_hunk_size=7" data-left-range="1-11" data-right-range="1-11"> Expand Up @@ -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 = {};
Expand Down
11 changes: 0 additions & 11 deletions packages/core/src/render3/instructions/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/render3/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions packages/core/src/render3/util/view_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
0