refactor(ivy): remove load instruction (#32067)

These changes remove the `ɵɵload` instruction which isn't being generated anymore.

PR Close #32067
This commit is contained in:
Kristiyan Kostadinov
2019-08-12 08:11:32 +03:00
committed by Kara Erickson
parent 4ea3e7e000
commit 914900a561
12 changed files with 32 additions and 43 deletions

View File

@ -152,7 +152,6 @@ export {
ɵɵtemplate,
ɵɵembeddedViewEnd,
store as ɵstore,
ɵɵload,
ɵɵpipe,
ɵɵBaseDef,
ComponentDef as ɵComponentDef,

View File

@ -14,7 +14,7 @@ import {_sanitizeUrl, sanitizeSrcset} from '../sanitization/url_sanitizer';
import {addAllToArray} from '../util/array_utils';
import {assertDataInRange, assertDefined, assertEqual, assertGreaterThan} from '../util/assert';
import {attachPatchData} from './context_discovery';
import {bind, setDelayProjection, ɵɵload} from './instructions/all';
import {bind, setDelayProjection} from './instructions/all';
import {attachI18nOpCodesDebug} from './instructions/lview_debug';
import {TsickleIssue1009, allocExpando, elementAttributeInternal, elementPropertyInternal, getOrCreateTNode, setInputsForProperty, textBindingInternal} from './instructions/shared';
import {LContainer, NATIVE} from './interfaces/container';
@ -29,7 +29,7 @@ import {getIsParent, getLView, getPreviousOrParentTNode, setIsNotParent, setPrev
import {NO_CHANGE} from './tokens';
import {renderStringify} from './util/misc_utils';
import {findComponentView} from './util/view_traversal_utils';
import {getNativeByIndex, getNativeByTNode, getTNode} from './util/view_utils';
import {getNativeByIndex, getNativeByTNode, getTNode, load} from './util/view_utils';
const MARKER = `<EFBFBD>`;
@ -912,7 +912,7 @@ function removeNode(index: number, viewData: LView) {
nativeRemoveNode(viewData[RENDERER], removedPhRNode);
}
const slotValue = ɵɵload(index) as RElement | RComment | LContainer;
const slotValue = load(viewData, index) as RElement | RComment | LContainer;
if (isLContainer(slotValue)) {
const lContainer = slotValue as LContainer;
if (removedPhTNode.type !== TNodeType.Container) {

View File

@ -72,7 +72,6 @@ export {
ɵɵinjectAttribute,
ɵɵlistener,
ɵɵload,
ɵɵnamespaceHTML,
ɵɵnamespaceMathML,

View File

@ -16,7 +16,7 @@ import {BINDING_INDEX, HEADER_OFFSET, LView, RENDERER, TVIEW, T_HOST} from '../i
import {assertNodeType} from '../node_assert';
import {appendChild, removeView} from '../node_manipulation';
import {getCheckNoChangesMode, getIsParent, getLView, getPreviousOrParentTNode, setIsNotParent, setPreviousOrParentTNode} from '../state';
import {getNativeByTNode, loadInternal} from '../util/view_utils';
import {getNativeByTNode, load} from '../util/view_utils';
import {addToViewTree, createDirectivesAndLocals, createLContainer, createTView, getOrCreateTNode, resolveDirectives} from './shared';
@ -100,7 +100,7 @@ export function ɵɵtemplate(
export function ɵɵcontainerRefreshStart(index: number): void {
const lView = getLView();
const tView = lView[TVIEW];
let previousOrParentTNode = loadInternal(tView.data, index) as TNode;
let previousOrParentTNode = load(tView.data, index) as TNode;
ngDevMode && assertNodeType(previousOrParentTNode, TNodeType.Container);
setPreviousOrParentTNode(previousOrParentTNode, true);

View File

@ -7,7 +7,7 @@
*/
import {HEADER_OFFSET, TVIEW} from '../interfaces/view';
import {getContextLView, getLView} from '../state';
import {loadInternal} from '../util/view_utils';
import {load} from '../util/view_utils';
/** Store a value in the `data` at a given `index`. */
export function store<T>(index: number, value: T): void {
@ -35,14 +35,5 @@ export function store<T>(index: number, value: T): void {
*/
export function ɵɵreference<T>(index: number) {
const contextLView = getContextLView();
return loadInternal<T>(contextLView, index);
}
/**
* Retrieves a value from current `viewData`.
*
* @codeGenApi
*/
export function ɵɵload<T>(index: number): T {
return loadInternal<T>(getLView(), index);
return load<T>(contextLView, index);
}

View File

@ -76,7 +76,6 @@ export const angularCoreEnv: {[name: string]: Function} =
'ɵɵgetCurrentView': r3.ɵɵgetCurrentView,
'ɵɵrestoreView': r3.ɵɵrestoreView,
'ɵɵlistener': r3.ɵɵlistener,
'ɵɵload': r3.ɵɵload,
'ɵɵprojection': r3.ɵɵprojection,
'ɵɵupdateSyntheticHostBinding': r3.ɵɵupdateSyntheticHostBinding,
'ɵɵcomponentHostSyntheticListener': r3.ɵɵcomponentHostSyntheticListener,

View File

@ -9,12 +9,13 @@
import {WrappedValue} from '../change_detection/change_detection_util';
import {PipeTransform} from '../change_detection/pipe_transform';
import {store, ɵɵload} from './instructions/all';
import {store} from './instructions/all';
import {PipeDef, PipeDefList} from './interfaces/definition';
import {BINDING_INDEX, HEADER_OFFSET, TVIEW} from './interfaces/view';
import {ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunctionV} from './pure_function';
import {getLView} from './state';
import {NO_CHANGE} from './tokens';
import {load} from './util/view_utils';
@ -82,7 +83,7 @@ function getPipeDef(name: string, registry: PipeDefList | null): PipeDef<any> {
* @codeGenApi
*/
export function ɵɵpipeBind1(index: number, slotOffset: number, v1: any): any {
const pipeInstance = ɵɵload<PipeTransform>(index);
const pipeInstance = load<PipeTransform>(getLView(), index);
return unwrapValue(
isPure(index) ? ɵɵpureFunction1(slotOffset, pipeInstance.transform, v1, pipeInstance) :
pipeInstance.transform(v1));
@ -102,7 +103,7 @@ export function ɵɵpipeBind1(index: number, slotOffset: number, v1: any): any {
* @codeGenApi
*/
export function ɵɵpipeBind2(index: number, slotOffset: number, v1: any, v2: any): any {
const pipeInstance = ɵɵload<PipeTransform>(index);
const pipeInstance = load<PipeTransform>(getLView(), index);
return unwrapValue(
isPure(index) ? ɵɵpureFunction2(slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
pipeInstance.transform(v1, v2));
@ -123,7 +124,7 @@ export function ɵɵpipeBind2(index: number, slotOffset: number, v1: any, v2: an
* @codeGenApi
*/
export function ɵɵpipeBind3(index: number, slotOffset: number, v1: any, v2: any, v3: any): any {
const pipeInstance = ɵɵload<PipeTransform>(index);
const pipeInstance = load<PipeTransform>(getLView(), index);
return unwrapValue(
isPure(index) ?
ɵɵpureFunction3(slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
@ -147,7 +148,7 @@ export function ɵɵpipeBind3(index: number, slotOffset: number, v1: any, v2: an
*/
export function ɵɵpipeBind4(
index: number, slotOffset: number, v1: any, v2: any, v3: any, v4: any): any {
const pipeInstance = ɵɵload<PipeTransform>(index);
const pipeInstance = load<PipeTransform>(getLView(), index);
return unwrapValue(
isPure(index) ?
ɵɵpureFunction4(slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
@ -167,7 +168,7 @@ export function ɵɵpipeBind4(
* @codeGenApi
*/
export function ɵɵpipeBindV(index: number, slotOffset: number, values: [any, ...any[]]): any {
const pipeInstance = ɵɵload<PipeTransform>(index);
const pipeInstance = load<PipeTransform>(getLView(), index);
return unwrapValue(
isPure(index) ? ɵɵpureFunctionV(slotOffset, pipeInstance.transform, values, pipeInstance) :
pipeInstance.transform.apply(pipeInstance, values));

View File

@ -128,7 +128,7 @@ export function getTNode(index: number, view: LView): TNode {
}
/** Retrieves a value from any `LView` or `TData`. */
export function loadInternal<T>(view: LView | TData, index: number): T {
export function load<T>(view: LView | TData, index: number): T {
ngDevMode && assertDataInRange(view, index + HEADER_OFFSET);
return view[index + HEADER_OFFSET];
}