refactor(core): renamed `previousOrParent` to `currentTNode` (#38707)
The previous name of `previousOrParent` was confusing. Changed the terminology to `currentTNode`. PR Close #38707
This commit is contained in:
parent
7bd18fca19
commit
5448e84cf0
|
@ -6,15 +6,14 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assertDefined, assertEqual, assertNumber, throwError } from '../util/assert';
|
import {assertDefined, assertEqual, assertNumber, throwError} from '../util/assert';
|
||||||
import { getComponentDef, getNgModuleDef } from './definition';
|
import {getComponentDef, getNgModuleDef} from './definition';
|
||||||
import { LContainer } from './interfaces/container';
|
import {LContainer} from './interfaces/container';
|
||||||
import { DirectiveDef } from './interfaces/definition';
|
import {DirectiveDef} from './interfaces/definition';
|
||||||
import { PARENT_INJECTOR } from './interfaces/injector';
|
import {PARENT_INJECTOR} from './interfaces/injector';
|
||||||
import { TNode } from './interfaces/node';
|
import {TNode} from './interfaces/node';
|
||||||
import { isLContainer, isLView } from './interfaces/type_checks';
|
import {isLContainer, isLView} from './interfaces/type_checks';
|
||||||
import { HEADER_OFFSET, LView, TVIEW, TView } from './interfaces/view';
|
import {HEADER_OFFSET, LView, TVIEW, TView} from './interfaces/view';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// [Assert functions do not constraint type when they are guarded by a truthy
|
// [Assert functions do not constraint type when they are guarded by a truthy
|
||||||
|
@ -49,13 +48,13 @@ export function assertNgModuleType(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assertPreviousIsParent(isParent: boolean) {
|
export function assertCurrentTNodeIsParent(isParent: boolean) {
|
||||||
assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
|
assertEqual(isParent, true, 'currentTNode should be a parent');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assertHasParent(tNode: TNode|null) {
|
export function assertHasParent(tNode: TNode|null) {
|
||||||
assertDefined(tNode, 'previousOrParentTNode should exist!');
|
assertDefined(tNode, 'currentTNode should exist!');
|
||||||
assertDefined(tNode!.parent, 'previousOrParentTNode should have a parent');
|
assertDefined(tNode!.parent, 'currentTNode should have a parent');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assertDataNext(lView: LView, index: number, arr?: any[]) {
|
export function assertDataNext(lView: LView, index: number, arr?: any[]) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import {Type} from '../core';
|
import {Type} from '../core';
|
||||||
import {Injector} from '../di/injector';
|
import {Injector} from '../di/injector';
|
||||||
import {Sanitizer} from '../sanitization/sanitizer';
|
import {Sanitizer} from '../sanitization/sanitizer';
|
||||||
import {assertIndexInRange} from '../util/assert';
|
import {assertDefined, assertIndexInRange} from '../util/assert';
|
||||||
|
|
||||||
import {assertComponentType} from './assert';
|
import {assertComponentType} from './assert';
|
||||||
import {getComponentDef} from './definition';
|
import {getComponentDef} from './definition';
|
||||||
|
@ -24,7 +24,7 @@ import {PlayerHandler} from './interfaces/player';
|
||||||
import {domRendererFactory3, RElement, Renderer3, RendererFactory3} from './interfaces/renderer';
|
import {domRendererFactory3, RElement, Renderer3, RendererFactory3} from './interfaces/renderer';
|
||||||
import {CONTEXT, HEADER_OFFSET, LView, LViewFlags, RootContext, RootContextFlags, TVIEW, TViewType} from './interfaces/view';
|
import {CONTEXT, HEADER_OFFSET, LView, LViewFlags, RootContext, RootContextFlags, TVIEW, TViewType} from './interfaces/view';
|
||||||
import {writeDirectClass, writeDirectStyle} from './node_manipulation';
|
import {writeDirectClass, writeDirectStyle} from './node_manipulation';
|
||||||
import {enterView, getPreviousOrParentTNode, leaveView, setSelectedIndex} from './state';
|
import {enterView, getCurrentTNode, leaveView, setSelectedIndex} from './state';
|
||||||
import {computeStaticStyling} from './styling/static_styling';
|
import {computeStaticStyling} from './styling/static_styling';
|
||||||
import {setUpAttributes} from './util/attrs_utils';
|
import {setUpAttributes} from './util/attrs_utils';
|
||||||
import {publishDefaultGlobalUtils} from './util/global_utils';
|
import {publishDefaultGlobalUtils} from './util/global_utils';
|
||||||
|
@ -229,7 +229,8 @@ export function createRootComponent<T>(
|
||||||
componentDef.contentQueries(RenderFlags.Create, component, rootLView.length - 1);
|
componentDef.contentQueries(RenderFlags.Create, component, rootLView.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootTNode = getPreviousOrParentTNode()!;
|
const rootTNode = getCurrentTNode()!;
|
||||||
|
ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
|
||||||
if (tView.firstCreatePass &&
|
if (tView.firstCreatePass &&
|
||||||
(componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
|
(componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
|
||||||
const elementIndex = rootTNode.index - HEADER_OFFSET;
|
const elementIndex = rootTNode.index - HEADER_OFFSET;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {NodeInjectorFactory} from './interfaces/injector';
|
||||||
import {TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNodeProviderIndexes} from './interfaces/node';
|
import {TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNodeProviderIndexes} from './interfaces/node';
|
||||||
import {isComponentDef} from './interfaces/type_checks';
|
import {isComponentDef} from './interfaces/type_checks';
|
||||||
import {DestroyHookData, LView, TData, TVIEW, TView} from './interfaces/view';
|
import {DestroyHookData, LView, TData, TVIEW, TView} from './interfaces/view';
|
||||||
import {getLView, getPreviousOrParentTNode, getTView} from './state';
|
import {getCurrentTNode, getLView, getTView} from './state';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ function resolveProvider(
|
||||||
let token: any = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
let token: any = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
||||||
let providerFactory: () => any = providerToFactory(provider);
|
let providerFactory: () => any = providerToFactory(provider);
|
||||||
|
|
||||||
const tNode = getPreviousOrParentTNode()!;
|
const tNode = getCurrentTNode()!;
|
||||||
const beginIndex = tNode.providerIndexes & TNodeProviderIndexes.ProvidersStartIndexMask;
|
const beginIndex = tNode.providerIndexes & TNodeProviderIndexes.ProvidersStartIndexMask;
|
||||||
const endIndex = tNode.directiveStart;
|
const endIndex = tNode.directiveStart;
|
||||||
const cptViewProvidersCount =
|
const cptViewProvidersCount =
|
||||||
|
|
|
@ -18,9 +18,10 @@ import {SanitizerFn} from '../interfaces/sanitization';
|
||||||
import {isLContainer} from '../interfaces/type_checks';
|
import {isLContainer} from '../interfaces/type_checks';
|
||||||
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TView} from '../interfaces/view';
|
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TView} from '../interfaces/view';
|
||||||
import {appendChild, applyProjection, createTextNode, nativeRemoveNode} from '../node_manipulation';
|
import {appendChild, applyProjection, createTextNode, nativeRemoveNode} from '../node_manipulation';
|
||||||
import {getBindingIndex, getLView, getPreviousOrParentTNode, getTView, setIsNotParent, setPreviousOrParentTNode} from '../state';
|
import {getBindingIndex, getCurrentTNode, getLView, getTView, setCurrentTNode, setCurrentTNodeAsNotParent} from '../state';
|
||||||
import {renderStringify} from '../util/misc_utils';
|
import {renderStringify} from '../util/misc_utils';
|
||||||
import {getNativeByIndex, getNativeByTNode, getTNode, load} from '../util/view_utils';
|
import {getNativeByIndex, getNativeByTNode, getTNode, load} from '../util/view_utils';
|
||||||
|
|
||||||
import {getLocaleId} from './i18n_locale_id';
|
import {getLocaleId} from './i18n_locale_id';
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ export function applyCreateOpCodes(
|
||||||
currentTNode =
|
currentTNode =
|
||||||
createDynamicNodeAtIndex(tView, lView, textNodeIndex, TNodeType.Element, textRNode, null);
|
createDynamicNodeAtIndex(tView, lView, textNodeIndex, TNodeType.Element, textRNode, null);
|
||||||
visitedNodes.push(textNodeIndex);
|
visitedNodes.push(textNodeIndex);
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
} else if (typeof opCode == 'number') {
|
} else if (typeof opCode == 'number') {
|
||||||
switch (opCode & I18nMutateOpCode.MASK_INSTRUCTION) {
|
switch (opCode & I18nMutateOpCode.MASK_INSTRUCTION) {
|
||||||
case I18nMutateOpCode.AppendChild:
|
case I18nMutateOpCode.AppendChild:
|
||||||
|
@ -120,13 +121,13 @@ export function applyCreateOpCodes(
|
||||||
previousTNode = currentTNode;
|
previousTNode = currentTNode;
|
||||||
currentTNode = getTNode(tView, nodeIndex);
|
currentTNode = getTNode(tView, nodeIndex);
|
||||||
if (currentTNode) {
|
if (currentTNode) {
|
||||||
setPreviousOrParentTNode(currentTNode, isParent);
|
setCurrentTNode(currentTNode, isParent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case I18nMutateOpCode.ElementEnd:
|
case I18nMutateOpCode.ElementEnd:
|
||||||
const elementIndex = opCode >>> I18nMutateOpCode.SHIFT_REF;
|
const elementIndex = opCode >>> I18nMutateOpCode.SHIFT_REF;
|
||||||
previousTNode = currentTNode = getTNode(tView, elementIndex);
|
previousTNode = currentTNode = getTNode(tView, elementIndex);
|
||||||
setPreviousOrParentTNode(currentTNode, false);
|
setCurrentTNode(currentTNode, false);
|
||||||
break;
|
break;
|
||||||
case I18nMutateOpCode.Attr:
|
case I18nMutateOpCode.Attr:
|
||||||
const elementNodeIndex = opCode >>> I18nMutateOpCode.SHIFT_REF;
|
const elementNodeIndex = opCode >>> I18nMutateOpCode.SHIFT_REF;
|
||||||
|
@ -157,7 +158,7 @@ export function applyCreateOpCodes(
|
||||||
visitedNodes.push(commentNodeIndex);
|
visitedNodes.push(commentNodeIndex);
|
||||||
attachPatchData(commentRNode, lView);
|
attachPatchData(commentRNode, lView);
|
||||||
// We will add the case nodes later, during the update phase
|
// We will add the case nodes later, during the update phase
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
break;
|
break;
|
||||||
case ELEMENT_MARKER:
|
case ELEMENT_MARKER:
|
||||||
const tagNameValue = createOpCodes[++i] as string;
|
const tagNameValue = createOpCodes[++i] as string;
|
||||||
|
@ -179,7 +180,7 @@ export function applyCreateOpCodes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
|
|
||||||
return visitedNodes;
|
return visitedNodes;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +412,7 @@ export function i18nEndFirstPass(tView: TView, lView: LView) {
|
||||||
ngDevMode && assertDefined(tI18n, `You should call i18nStart before i18nEnd`);
|
ngDevMode && assertDefined(tI18n, `You should call i18nStart before i18nEnd`);
|
||||||
|
|
||||||
// Find the last node that was added before `i18nEnd`
|
// Find the last node that was added before `i18nEnd`
|
||||||
const lastCreatedNode = getPreviousOrParentTNode();
|
const lastCreatedNode = getCurrentTNode();
|
||||||
|
|
||||||
// Read the instructions to insert/move/remove DOM elements
|
// Read the instructions to insert/move/remove DOM elements
|
||||||
const visitedNodes = applyCreateOpCodes(tView, rootIndex, tI18n.create, lView);
|
const visitedNodes = applyCreateOpCodes(tView, rootIndex, tI18n.create, lView);
|
||||||
|
@ -465,7 +466,7 @@ function removeNode(tView: TView, lView: LView, index: number, markAsDetached: b
|
||||||
function createDynamicNodeAtIndex(
|
function createDynamicNodeAtIndex(
|
||||||
tView: TView, lView: LView, index: number, type: TNodeType, native: RElement|RText|null,
|
tView: TView, lView: LView, index: number, type: TNodeType, native: RElement|RText|null,
|
||||||
name: string|null): TElementNode|TIcuContainerNode {
|
name: string|null): TElementNode|TIcuContainerNode {
|
||||||
const previousOrParentTNode = getPreviousOrParentTNode();
|
const currentTNode = getCurrentTNode();
|
||||||
ngDevMode && assertIndexInRange(lView, index + HEADER_OFFSET);
|
ngDevMode && assertIndexInRange(lView, index + HEADER_OFFSET);
|
||||||
lView[index + HEADER_OFFSET] = native;
|
lView[index + HEADER_OFFSET] = native;
|
||||||
// FIXME(misko): Why does this create A TNode??? I would not expect this to be here.
|
// FIXME(misko): Why does this create A TNode??? I would not expect this to be here.
|
||||||
|
@ -473,8 +474,8 @@ function createDynamicNodeAtIndex(
|
||||||
|
|
||||||
// We are creating a dynamic node, the previous tNode might not be pointing at this node.
|
// We are creating a dynamic node, the previous tNode might not be pointing at this node.
|
||||||
// We will link ourselves into the tree later with `appendI18nNode`.
|
// We will link ourselves into the tree later with `appendI18nNode`.
|
||||||
if (previousOrParentTNode && previousOrParentTNode.next === tNode) {
|
if (currentTNode && currentTNode.next === tNode) {
|
||||||
previousOrParentTNode.next = null;
|
currentTNode.next = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tNode;
|
return tNode;
|
||||||
|
|
|
@ -100,7 +100,7 @@ export function i18nMutateOpCodesToString(
|
||||||
return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${
|
return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${
|
||||||
parser.consumeString()}")`;
|
parser.consumeString()}")`;
|
||||||
case I18nMutateOpCode.ElementEnd:
|
case I18nMutateOpCode.ElementEnd:
|
||||||
return `setPreviousOrParentTNode(tView.data[${ref}] as TNode)`;
|
return `setCurrentTNode(tView.data[${ref}] as TNode)`;
|
||||||
case I18nMutateOpCode.RemoveNestedIcu:
|
case I18nMutateOpCode.RemoveNestedIcu:
|
||||||
return `removeNestedICU(${ref})`;
|
return `removeNestedICU(${ref})`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {TNodeType} from '../interfaces/node';
|
||||||
import {RComment, RElement} from '../interfaces/renderer';
|
import {RComment, RElement} from '../interfaces/renderer';
|
||||||
import {SanitizerFn} from '../interfaces/sanitization';
|
import {SanitizerFn} from '../interfaces/sanitization';
|
||||||
import {HEADER_OFFSET, LView, T_HOST, TView} from '../interfaces/view';
|
import {HEADER_OFFSET, LView, T_HOST, TView} from '../interfaces/view';
|
||||||
import {getIsParent, getPreviousOrParentTNode} from '../state';
|
import {getCurrentTNode, isCurrentTNodeParent} from '../state';
|
||||||
import {attachDebugGetter} from '../util/debug_utils';
|
import {attachDebugGetter} from '../util/debug_utils';
|
||||||
import {getNativeByIndex, getTNode} from '../util/view_utils';
|
import {getNativeByIndex, getTNode} from '../util/view_utils';
|
||||||
|
|
||||||
|
@ -70,9 +70,8 @@ export function i18nStartFirstPass(
|
||||||
lView: LView, tView: TView, index: number, message: string, subTemplateIndex?: number) {
|
lView: LView, tView: TView, index: number, message: string, subTemplateIndex?: number) {
|
||||||
const startIndex = tView.blueprint.length - HEADER_OFFSET;
|
const startIndex = tView.blueprint.length - HEADER_OFFSET;
|
||||||
i18nVarsCount = 0;
|
i18nVarsCount = 0;
|
||||||
const previousOrParentTNode = getPreviousOrParentTNode()!;
|
const currentTNode = getCurrentTNode()!;
|
||||||
const parentTNode =
|
const parentTNode = isCurrentTNodeParent() ? currentTNode : currentTNode && currentTNode.parent;
|
||||||
getIsParent() ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
|
||||||
let parentIndex =
|
let parentIndex =
|
||||||
parentTNode && parentTNode !== lView[T_HOST] ? parentTNode.index - HEADER_OFFSET : index;
|
parentTNode && parentTNode !== lView[T_HOST] ? parentTNode.index - HEADER_OFFSET : index;
|
||||||
let parentIndexPointer = 0;
|
let parentIndexPointer = 0;
|
||||||
|
@ -86,11 +85,11 @@ export function i18nStartFirstPass(
|
||||||
// keep track whether an element was a parent node or not, so that the logic that consumes
|
// keep track whether an element was a parent node or not, so that the logic that consumes
|
||||||
// the generated `I18nMutateOpCode`s can leverage this information to properly set TNode state
|
// the generated `I18nMutateOpCode`s can leverage this information to properly set TNode state
|
||||||
// (whether it's a parent or sibling).
|
// (whether it's a parent or sibling).
|
||||||
if (index > 0 && previousOrParentTNode !== parentTNode) {
|
if (index > 0 && currentTNode !== parentTNode) {
|
||||||
let previousTNodeIndex = previousOrParentTNode.index - HEADER_OFFSET;
|
let previousTNodeIndex = currentTNode.index - HEADER_OFFSET;
|
||||||
// If current TNode is a sibling node, encode it using a negative index. This information is
|
// If current TNode is a sibling node, encode it using a negative index. This information is
|
||||||
// required when the `Select` action is processed (see the `readCreateOpCodes` function).
|
// required when the `Select` action is processed (see the `readCreateOpCodes` function).
|
||||||
if (!getIsParent()) {
|
if (!isCurrentTNodeParent()) {
|
||||||
previousTNodeIndex = ~previousTNodeIndex;
|
previousTNodeIndex = ~previousTNodeIndex;
|
||||||
}
|
}
|
||||||
// Create an OpCode to select the previous TNode
|
// Create an OpCode to select the previous TNode
|
||||||
|
@ -212,7 +211,7 @@ export function i18nStartFirstPass(
|
||||||
*/
|
*/
|
||||||
export function i18nAttributesFirstPass(
|
export function i18nAttributesFirstPass(
|
||||||
lView: LView, tView: TView, index: number, values: string[]) {
|
lView: LView, tView: TView, index: number, values: string[]) {
|
||||||
const previousElement = getPreviousOrParentTNode()!;
|
const previousElement = getCurrentTNode()!;
|
||||||
const previousElementIndex = previousElement.index - HEADER_OFFSET;
|
const previousElementIndex = previousElement.index - HEADER_OFFSET;
|
||||||
const updateOpCodes: I18nUpdateOpCodes = [];
|
const updateOpCodes: I18nUpdateOpCodes = [];
|
||||||
if (ngDevMode) {
|
if (ngDevMode) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {assertInjectImplementationNot, ɵɵinject} from '../../di/injector_compa
|
||||||
import {Type} from '../../interface/type';
|
import {Type} from '../../interface/type';
|
||||||
import {getOrCreateInjectable, injectAttributeImpl} from '../di';
|
import {getOrCreateInjectable, injectAttributeImpl} from '../di';
|
||||||
import {TDirectiveHostNode} from '../interfaces/node';
|
import {TDirectiveHostNode} from '../interfaces/node';
|
||||||
import {getLView, getPreviousOrParentTNode} from '../state';
|
import {getCurrentTNode, getLView} from '../state';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value associated to the given token from the injectors.
|
* Returns the value associated to the given token from the injectors.
|
||||||
|
@ -48,7 +48,7 @@ export function ɵɵdirectiveInject<T>(
|
||||||
ngDevMode && assertInjectImplementationNot(ɵɵdirectiveInject);
|
ngDevMode && assertInjectImplementationNot(ɵɵdirectiveInject);
|
||||||
return ɵɵinject(token, flags);
|
return ɵɵinject(token, flags);
|
||||||
}
|
}
|
||||||
const tNode = getPreviousOrParentTNode();
|
const tNode = getCurrentTNode();
|
||||||
return getOrCreateInjectable<T>(
|
return getOrCreateInjectable<T>(
|
||||||
tNode as TDirectiveHostNode, lView, resolveForwardRef(token), flags);
|
tNode as TDirectiveHostNode, lView, resolveForwardRef(token), flags);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ export function ɵɵdirectiveInject<T>(
|
||||||
* @codeGenApi
|
* @codeGenApi
|
||||||
*/
|
*/
|
||||||
export function ɵɵinjectAttribute(attrNameToInject: string): string|null {
|
export function ɵɵinjectAttribute(attrNameToInject: string): string|null {
|
||||||
return injectAttributeImpl(getPreviousOrParentTNode()!, attrNameToInject);
|
return injectAttributeImpl(getCurrentTNode()!, attrNameToInject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {isContentQueryHost, isDirectiveHost} from '../interfaces/type_checks';
|
||||||
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TVIEW, TView} from '../interfaces/view';
|
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TVIEW, TView} from '../interfaces/view';
|
||||||
import {assertNodeType} from '../node_assert';
|
import {assertNodeType} from '../node_assert';
|
||||||
import {appendChild, writeDirectClass, writeDirectStyle} from '../node_manipulation';
|
import {appendChild, writeDirectClass, writeDirectStyle} from '../node_manipulation';
|
||||||
import {decreaseElementDepthCount, getBindingIndex, getElementDepthCount, getIsParent, getLView, getNamespace, getPreviousOrParentTNode, getTView, increaseElementDepthCount, setIsNotParent, setPreviousOrParentTNode} from '../state';
|
import {decreaseElementDepthCount, getBindingIndex, getCurrentTNode, getElementDepthCount, getLView, getNamespace, getTView, increaseElementDepthCount, isCurrentTNodeParent, setCurrentTNode, setCurrentTNodeAsNotParent} from '../state';
|
||||||
import {computeStaticStyling} from '../styling/static_styling';
|
import {computeStaticStyling} from '../styling/static_styling';
|
||||||
import {setUpAttributes} from '../util/attrs_utils';
|
import {setUpAttributes} from '../util/attrs_utils';
|
||||||
import {getConstant} from '../util/view_utils';
|
import {getConstant} from '../util/view_utils';
|
||||||
|
@ -87,7 +87,7 @@ export function ɵɵelementStart(
|
||||||
const tNode = tView.firstCreatePass ?
|
const tNode = tView.firstCreatePass ?
|
||||||
elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) :
|
elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) :
|
||||||
tView.data[adjustedIndex] as TElementNode;
|
tView.data[adjustedIndex] as TElementNode;
|
||||||
setPreviousOrParentTNode(tNode, true);
|
setCurrentTNode(tNode, true);
|
||||||
|
|
||||||
const mergedAttrs = tNode.mergedAttrs;
|
const mergedAttrs = tNode.mergedAttrs;
|
||||||
if (mergedAttrs !== null) {
|
if (mergedAttrs !== null) {
|
||||||
|
@ -128,17 +128,17 @@ export function ɵɵelementStart(
|
||||||
* @codeGenApi
|
* @codeGenApi
|
||||||
*/
|
*/
|
||||||
export function ɵɵelementEnd(): void {
|
export function ɵɵelementEnd(): void {
|
||||||
let previousOrParentTNode = getPreviousOrParentTNode()!;
|
let currentTNode = getCurrentTNode()!;
|
||||||
ngDevMode && assertDefined(previousOrParentTNode, 'No parent node to close.');
|
ngDevMode && assertDefined(currentTNode, 'No parent node to close.');
|
||||||
if (getIsParent()) {
|
if (isCurrentTNodeParent()) {
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
} else {
|
} else {
|
||||||
ngDevMode && assertHasParent(getPreviousOrParentTNode());
|
ngDevMode && assertHasParent(getCurrentTNode());
|
||||||
previousOrParentTNode = previousOrParentTNode.parent!;
|
currentTNode = currentTNode.parent!;
|
||||||
setPreviousOrParentTNode(previousOrParentTNode, false);
|
setCurrentTNode(currentTNode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tNode = previousOrParentTNode;
|
const tNode = currentTNode;
|
||||||
ngDevMode && assertNodeType(tNode, TNodeType.Element);
|
ngDevMode && assertNodeType(tNode, TNodeType.Element);
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,9 +146,9 @@ export function ɵɵelementEnd(): void {
|
||||||
|
|
||||||
const tView = getTView();
|
const tView = getTView();
|
||||||
if (tView.firstCreatePass) {
|
if (tView.firstCreatePass) {
|
||||||
registerPostOrderHooks(tView, previousOrParentTNode);
|
registerPostOrderHooks(tView, currentTNode);
|
||||||
if (isContentQueryHost(previousOrParentTNode)) {
|
if (isContentQueryHost(currentTNode)) {
|
||||||
tView.queries!.elementEnd(previousOrParentTNode);
|
tView.queries!.elementEnd(currentTNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {isContentQueryHost, isDirectiveHost} from '../interfaces/type_checks';
|
||||||
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TView} from '../interfaces/view';
|
import {HEADER_OFFSET, LView, RENDERER, T_HOST, TView} from '../interfaces/view';
|
||||||
import {assertNodeType} from '../node_assert';
|
import {assertNodeType} from '../node_assert';
|
||||||
import {appendChild} from '../node_manipulation';
|
import {appendChild} from '../node_manipulation';
|
||||||
import {getBindingIndex, getIsParent, getLView, getPreviousOrParentTNode, getTView, setIsNotParent, setPreviousOrParentTNode} from '../state';
|
import {getBindingIndex, getCurrentTNode, getLView, getTView, isCurrentTNodeParent, setCurrentTNode, setCurrentTNodeAsNotParent} from '../state';
|
||||||
import {computeStaticStyling} from '../styling/static_styling';
|
import {computeStaticStyling} from '../styling/static_styling';
|
||||||
import {getConstant} from '../util/view_utils';
|
import {getConstant} from '../util/view_utils';
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ export function ɵɵelementContainerStart(
|
||||||
const tNode = tView.firstCreatePass ?
|
const tNode = tView.firstCreatePass ?
|
||||||
elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) :
|
elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) :
|
||||||
tView.data[adjustedIndex] as TElementContainerNode;
|
tView.data[adjustedIndex] as TElementContainerNode;
|
||||||
setPreviousOrParentTNode(tNode, true);
|
setCurrentTNode(tNode, true);
|
||||||
|
|
||||||
ngDevMode && ngDevMode.rendererCreateComment++;
|
ngDevMode && ngDevMode.rendererCreateComment++;
|
||||||
const native = lView[adjustedIndex] =
|
const native = lView[adjustedIndex] =
|
||||||
|
@ -98,22 +98,22 @@ export function ɵɵelementContainerStart(
|
||||||
* @codeGenApi
|
* @codeGenApi
|
||||||
*/
|
*/
|
||||||
export function ɵɵelementContainerEnd(): void {
|
export function ɵɵelementContainerEnd(): void {
|
||||||
let previousOrParentTNode = getPreviousOrParentTNode()!;
|
let currentTNode = getCurrentTNode()!;
|
||||||
const tView = getTView();
|
const tView = getTView();
|
||||||
if (getIsParent()) {
|
if (isCurrentTNodeParent()) {
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
} else {
|
} else {
|
||||||
ngDevMode && assertHasParent(previousOrParentTNode);
|
ngDevMode && assertHasParent(currentTNode);
|
||||||
previousOrParentTNode = previousOrParentTNode.parent!;
|
currentTNode = currentTNode.parent!;
|
||||||
setPreviousOrParentTNode(previousOrParentTNode, false);
|
setCurrentTNode(currentTNode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngDevMode && assertNodeType(previousOrParentTNode, TNodeType.ElementContainer);
|
ngDevMode && assertNodeType(currentTNode, TNodeType.ElementContainer);
|
||||||
|
|
||||||
if (tView.firstCreatePass) {
|
if (tView.firstCreatePass) {
|
||||||
registerPostOrderHooks(tView, previousOrParentTNode);
|
registerPostOrderHooks(tView, currentTNode);
|
||||||
if (isContentQueryHost(previousOrParentTNode)) {
|
if (isContentQueryHost(currentTNode)) {
|
||||||
tView.queries!.elementEnd(previousOrParentTNode);
|
tView.queries!.elementEnd(currentTNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {GlobalTargetResolver, isProceduralRenderer, RElement, Renderer3} from '.
|
||||||
import {isDirectiveHost} from '../interfaces/type_checks';
|
import {isDirectiveHost} from '../interfaces/type_checks';
|
||||||
import {CLEANUP, FLAGS, LView, LViewFlags, RENDERER, TView} from '../interfaces/view';
|
import {CLEANUP, FLAGS, LView, LViewFlags, RENDERER, TView} from '../interfaces/view';
|
||||||
import {assertNodeOfPossibleTypes} from '../node_assert';
|
import {assertNodeOfPossibleTypes} from '../node_assert';
|
||||||
import {getCurrentDirectiveDef, getLView, getPreviousOrParentTNode, getTView} from '../state';
|
import {getCurrentDirectiveDef, getCurrentTNode, getLView, getTView} from '../state';
|
||||||
import {getComponentLViewByIndex, getNativeByTNode, unwrapRNode} from '../util/view_utils';
|
import {getComponentLViewByIndex, getNativeByTNode, unwrapRNode} from '../util/view_utils';
|
||||||
|
|
||||||
import {getLCleanup, handleError, loadComponentRenderer, markViewDirty} from './shared';
|
import {getLCleanup, handleError, loadComponentRenderer, markViewDirty} from './shared';
|
||||||
|
@ -41,7 +41,7 @@ export function ɵɵlistener(
|
||||||
eventTargetResolver?: GlobalTargetResolver): typeof ɵɵlistener {
|
eventTargetResolver?: GlobalTargetResolver): typeof ɵɵlistener {
|
||||||
const lView = getLView();
|
const lView = getLView();
|
||||||
const tView = getTView();
|
const tView = getTView();
|
||||||
const tNode = getPreviousOrParentTNode()!;
|
const tNode = getCurrentTNode()!;
|
||||||
listenerInternal(
|
listenerInternal(
|
||||||
tView, lView, lView[RENDERER], tNode, eventName, listenerFn, useCapture, eventTargetResolver);
|
tView, lView, lView[RENDERER], tNode, eventName, listenerFn, useCapture, eventTargetResolver);
|
||||||
return ɵɵlistener;
|
return ɵɵlistener;
|
||||||
|
@ -71,7 +71,7 @@ export function ɵɵlistener(
|
||||||
export function ɵɵsyntheticHostListener(
|
export function ɵɵsyntheticHostListener(
|
||||||
eventName: string, listenerFn: (e?: any) => any, useCapture = false,
|
eventName: string, listenerFn: (e?: any) => any, useCapture = false,
|
||||||
eventTargetResolver?: GlobalTargetResolver): typeof ɵɵsyntheticHostListener {
|
eventTargetResolver?: GlobalTargetResolver): typeof ɵɵsyntheticHostListener {
|
||||||
const tNode = getPreviousOrParentTNode()!;
|
const tNode = getCurrentTNode()!;
|
||||||
const lView = getLView();
|
const lView = getLView();
|
||||||
const tView = getTView();
|
const tView = getTView();
|
||||||
const currentDef = getCurrentDirectiveDef(tView.data);
|
const currentDef = getCurrentDirectiveDef(tView.data);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {ProjectionSlots} from '../interfaces/projection';
|
||||||
import {DECLARATION_COMPONENT_VIEW, T_HOST} from '../interfaces/view';
|
import {DECLARATION_COMPONENT_VIEW, T_HOST} from '../interfaces/view';
|
||||||
import {applyProjection} from '../node_manipulation';
|
import {applyProjection} from '../node_manipulation';
|
||||||
import {getProjectAsAttrValue, isNodeMatchingSelectorList, isSelectorInSelectorList} from '../node_selector_matcher';
|
import {getProjectAsAttrValue, isNodeMatchingSelectorList, isSelectorInSelectorList} from '../node_selector_matcher';
|
||||||
import {getLView, getTView, setIsNotParent} from '../state';
|
import {getLView, getTView, setCurrentTNodeAsNotParent} from '../state';
|
||||||
import {getOrCreateTNode} from './shared';
|
import {getOrCreateTNode} from './shared';
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ export function ɵɵprojection(
|
||||||
if (tProjectionNode.projection === null) tProjectionNode.projection = selectorIndex;
|
if (tProjectionNode.projection === null) tProjectionNode.projection = selectorIndex;
|
||||||
|
|
||||||
// `<ng-content>` has no content
|
// `<ng-content>` has no content
|
||||||
setIsNotParent();
|
setCurrentTNodeAsNotParent();
|
||||||
|
|
||||||
// We might need to delay the projection of nodes if they are in the middle of an i18n block
|
// We might need to delay the projection of nodes if they are in the middle of an i18n block
|
||||||
if (!delayProjection) {
|
if (!delayProjection) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import {isComponentDef, isComponentHost, isContentQueryHost, isLContainer, isRoo
|
||||||
import {CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DECLARATION_COMPONENT_VIEW, DECLARATION_VIEW, FLAGS, HEADER_OFFSET, HOST, InitPhaseState, INJECTOR, LView, LViewFlags, NEXT, PARENT, RENDERER, RENDERER_FACTORY, RootContext, RootContextFlags, SANITIZER, T_HOST, TData, TRANSPLANTED_VIEWS_TO_REFRESH, TVIEW, TView, TViewType} from '../interfaces/view';
|
import {CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DECLARATION_COMPONENT_VIEW, DECLARATION_VIEW, FLAGS, HEADER_OFFSET, HOST, InitPhaseState, INJECTOR, LView, LViewFlags, NEXT, PARENT, RENDERER, RENDERER_FACTORY, RootContext, RootContextFlags, SANITIZER, T_HOST, TData, TRANSPLANTED_VIEWS_TO_REFRESH, TVIEW, TView, TViewType} from '../interfaces/view';
|
||||||
import {assertNodeNotOfTypes, assertNodeOfPossibleTypes} from '../node_assert';
|
import {assertNodeNotOfTypes, assertNodeOfPossibleTypes} from '../node_assert';
|
||||||
import {isInlineTemplate, isNodeMatchingSelectorList} from '../node_selector_matcher';
|
import {isInlineTemplate, isNodeMatchingSelectorList} from '../node_selector_matcher';
|
||||||
import {enterView, getBindingsEnabled, getCheckNoChangesMode, getCurrentDirectiveIndex, getIsParent, getPreviousOrParentTNode, getSelectedIndex, leaveView, setBindingIndex, setBindingRootForHostBindings, setCheckNoChangesMode, setCurrentDirectiveIndex, setCurrentQueryIndex, setPreviousOrParentTNode, setSelectedIndex} from '../state';
|
import {enterView, getBindingsEnabled, getCheckNoChangesMode, getCurrentDirectiveIndex, getCurrentTNode, getSelectedIndex, isCurrentTNodeParent, leaveView, setBindingIndex, setBindingRootForHostBindings, setCheckNoChangesMode, setCurrentDirectiveIndex, setCurrentQueryIndex, setCurrentTNode, setSelectedIndex} from '../state';
|
||||||
import {NO_CHANGE} from '../tokens';
|
import {NO_CHANGE} from '../tokens';
|
||||||
import {isAnimationProp, mergeHostAttrs} from '../util/attrs_utils';
|
import {isAnimationProp, mergeHostAttrs} from '../util/attrs_utils';
|
||||||
import {INTERPOLATION_DELIMITER, renderStringify, stringifyForError} from '../util/misc_utils';
|
import {INTERPOLATION_DELIMITER, renderStringify, stringifyForError} from '../util/misc_utils';
|
||||||
|
@ -232,7 +232,7 @@ export function getOrCreateTNode(
|
||||||
const adjustedIndex = index + HEADER_OFFSET;
|
const adjustedIndex = index + HEADER_OFFSET;
|
||||||
const tNode = tView.data[adjustedIndex] as TNode ||
|
const tNode = tView.data[adjustedIndex] as TNode ||
|
||||||
createTNodeAtIndex(tView, adjustedIndex, type, name, attrs);
|
createTNodeAtIndex(tView, adjustedIndex, type, name, attrs);
|
||||||
setPreviousOrParentTNode(tNode, true);
|
setCurrentTNode(tNode, true);
|
||||||
return tNode as TElementNode & TContainerNode & TElementContainerNode & TProjectionNode &
|
return tNode as TElementNode & TContainerNode & TElementContainerNode & TProjectionNode &
|
||||||
TIcuContainerNode;
|
TIcuContainerNode;
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,9 @@ export function getOrCreateTNode(
|
||||||
function createTNodeAtIndex(
|
function createTNodeAtIndex(
|
||||||
tView: TView, adjustedIndex: number, type: TNodeType, name: string|null,
|
tView: TView, adjustedIndex: number, type: TNodeType, name: string|null,
|
||||||
attrs: TAttributes|null) {
|
attrs: TAttributes|null) {
|
||||||
const previousOrParentTNode = getPreviousOrParentTNode();
|
const currentTNode = getCurrentTNode();
|
||||||
const isParent = getIsParent();
|
const isParent = isCurrentTNodeParent();
|
||||||
const parent =
|
const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
|
||||||
isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
|
||||||
// Parents cannot cross component boundaries because components will be used in multiple places.
|
// Parents cannot cross component boundaries because components will be used in multiple places.
|
||||||
const tNode = tView.data[adjustedIndex] =
|
const tNode = tView.data[adjustedIndex] =
|
||||||
createTNode(tView, parent as TElementNode | TContainerNode, type, adjustedIndex, name, attrs);
|
createTNode(tView, parent as TElementNode | TContainerNode, type, adjustedIndex, name, attrs);
|
||||||
|
@ -253,12 +252,12 @@ function createTNodeAtIndex(
|
||||||
if (tView.firstChild === null) {
|
if (tView.firstChild === null) {
|
||||||
tView.firstChild = tNode;
|
tView.firstChild = tNode;
|
||||||
}
|
}
|
||||||
if (previousOrParentTNode) {
|
if (currentTNode !== null) {
|
||||||
if (isParent && previousOrParentTNode.child == null && tNode.parent !== null) {
|
if (isParent && currentTNode.child == null && tNode.parent !== null) {
|
||||||
// We are in the same view, which means we are adding content node to the parent view.
|
// We are in the same view, which means we are adding content node to the parent view.
|
||||||
previousOrParentTNode.child = tNode;
|
currentTNode.child = tNode;
|
||||||
} else if (!isParent) {
|
} else if (!isParent) {
|
||||||
previousOrParentTNode.next = tNode;
|
currentTNode.next = tNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tNode;
|
return tNode;
|
||||||
|
@ -1125,7 +1124,7 @@ function logUnknownPropertyError(propName: string, tNode: TNode): void {
|
||||||
* Instantiate a root component.
|
* Instantiate a root component.
|
||||||
*/
|
*/
|
||||||
export function instantiateRootComponent<T>(tView: TView, lView: LView, def: ComponentDef<T>): T {
|
export function instantiateRootComponent<T>(tView: TView, lView: LView, def: ComponentDef<T>): T {
|
||||||
const rootTNode = getPreviousOrParentTNode()!;
|
const rootTNode = getCurrentTNode()!;
|
||||||
if (tView.firstCreatePass) {
|
if (tView.firstCreatePass) {
|
||||||
if (def.providersResolver) def.providersResolver(def);
|
if (def.providersResolver) def.providersResolver(def);
|
||||||
generateExpandoInstructionBlock(tView, rootTNode, 1);
|
generateExpandoInstructionBlock(tView, rootTNode, 1);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {LocalRefExtractor, TAttributes, TContainerNode, TNodeType} from '../inte
|
||||||
import {isDirectiveHost} from '../interfaces/type_checks';
|
import {isDirectiveHost} from '../interfaces/type_checks';
|
||||||
import {HEADER_OFFSET, LView, RENDERER, TView, TViewType} from '../interfaces/view';
|
import {HEADER_OFFSET, LView, RENDERER, TView, TViewType} from '../interfaces/view';
|
||||||
import {appendChild} from '../node_manipulation';
|
import {appendChild} from '../node_manipulation';
|
||||||
import {getLView, getTView, setPreviousOrParentTNode} from '../state';
|
import {getLView, getTView, setCurrentTNode} from '../state';
|
||||||
import {getConstant} from '../util/view_utils';
|
import {getConstant} from '../util/view_utils';
|
||||||
import {addToViewTree, createDirectivesInstances, createLContainer, createTView, getOrCreateTNode, resolveDirectives, saveResolvedLocalsInData} from './shared';
|
import {addToViewTree, createDirectivesInstances, createLContainer, createTView, getOrCreateTNode, resolveDirectives, saveResolvedLocalsInData} from './shared';
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export function ɵɵtemplate(
|
||||||
templateFirstCreatePass(
|
templateFirstCreatePass(
|
||||||
index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) :
|
index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) :
|
||||||
tView.data[adjustedIndex] as TContainerNode;
|
tView.data[adjustedIndex] as TContainerNode;
|
||||||
setPreviousOrParentTNode(tNode, false);
|
setCurrentTNode(tNode, false);
|
||||||
|
|
||||||
const comment = lView[RENDERER].createComment(ngDevMode ? 'container' : '');
|
const comment = lView[RENDERER].createComment(ngDevMode ? 'container' : '');
|
||||||
appendChild(tView, lView, comment, tNode);
|
appendChild(tView, lView, comment, tNode);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {assertEqual, assertIndexInRange} from '../../util/assert';
|
||||||
import {TElementNode, TNodeType} from '../interfaces/node';
|
import {TElementNode, TNodeType} from '../interfaces/node';
|
||||||
import {HEADER_OFFSET, RENDERER, T_HOST} from '../interfaces/view';
|
import {HEADER_OFFSET, RENDERER, T_HOST} from '../interfaces/view';
|
||||||
import {appendChild, createTextNode} from '../node_manipulation';
|
import {appendChild, createTextNode} from '../node_manipulation';
|
||||||
import {getBindingIndex, getLView, getTView, setPreviousOrParentTNode} from '../state';
|
import {getBindingIndex, getLView, getTView, setCurrentTNode} from '../state';
|
||||||
|
|
||||||
import {getOrCreateTNode} from './shared';
|
import {getOrCreateTNode} from './shared';
|
||||||
|
|
||||||
|
@ -42,5 +42,5 @@ export function ɵɵtext(index: number, value: string = ''): void {
|
||||||
appendChild(tView, lView, textNative, tNode);
|
appendChild(tView, lView, textNative, tNode);
|
||||||
|
|
||||||
// Text nodes are self closing.
|
// Text nodes are self closing.
|
||||||
setPreviousOrParentTNode(tNode, false);
|
setCurrentTNode(tNode, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeType, u
|
||||||
import {LQueries, LQuery, TQueries, TQuery, TQueryMetadata, unusedValueExportToPlacateAjd as unused4} from './interfaces/query';
|
import {LQueries, LQuery, TQueries, TQuery, TQueryMetadata, unusedValueExportToPlacateAjd as unused4} from './interfaces/query';
|
||||||
import {DECLARATION_LCONTAINER, LView, PARENT, QUERIES, TVIEW, TView} from './interfaces/view';
|
import {DECLARATION_LCONTAINER, LView, PARENT, QUERIES, TVIEW, TView} from './interfaces/view';
|
||||||
import {assertNodeOfPossibleTypes} from './node_assert';
|
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||||
import {getCurrentQueryIndex, getLView, getPreviousOrParentTNode, getTView, setCurrentQueryIndex} from './state';
|
import {getCurrentQueryIndex, getCurrentTNode, getLView, getTView, setCurrentQueryIndex} from './state';
|
||||||
import {isCreationMode} from './util/view_utils';
|
import {isCreationMode} from './util/view_utils';
|
||||||
import {createContainerRef, createElementRef, createTemplateRef} from './view_engine_compatibility';
|
import {createContainerRef, createElementRef, createTemplateRef} from './view_engine_compatibility';
|
||||||
|
|
||||||
|
@ -504,8 +504,7 @@ export function ɵɵcontentQuery<T>(
|
||||||
directiveIndex: number, predicate: Type<any>|InjectionToken<unknown>|string[], descend: boolean,
|
directiveIndex: number, predicate: Type<any>|InjectionToken<unknown>|string[], descend: boolean,
|
||||||
read?: any): void {
|
read?: any): void {
|
||||||
contentQueryInternal(
|
contentQueryInternal(
|
||||||
getTView(), getLView(), predicate, descend, read, false, getPreviousOrParentTNode()!,
|
getTView(), getLView(), predicate, descend, read, false, getCurrentTNode()!, directiveIndex);
|
||||||
directiveIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -524,8 +523,7 @@ export function ɵɵstaticContentQuery<T>(
|
||||||
directiveIndex: number, predicate: Type<any>|InjectionToken<unknown>|string[], descend: boolean,
|
directiveIndex: number, predicate: Type<any>|InjectionToken<unknown>|string[], descend: boolean,
|
||||||
read?: any): void {
|
read?: any): void {
|
||||||
contentQueryInternal(
|
contentQueryInternal(
|
||||||
getTView(), getLView(), predicate, descend, read, true, getPreviousOrParentTNode()!,
|
getTView(), getLView(), predicate, descend, read, true, getCurrentTNode()!, directiveIndex);
|
||||||
directiveIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function contentQueryInternal<T>(
|
function contentQueryInternal<T>(
|
||||||
|
|
|
@ -54,12 +54,12 @@ interface LFrame {
|
||||||
*
|
*
|
||||||
* This is used in conjunction with `isParent`.
|
* This is used in conjunction with `isParent`.
|
||||||
*/
|
*/
|
||||||
previousOrParentTNode: TNode|null;
|
currentTNode: TNode|null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If `isParent` is:
|
* If `isParent` is:
|
||||||
* - `true`: then `previousOrParentTNode` points to a parent node.
|
* - `true`: then `currentTNode` points to a parent node.
|
||||||
* - `false`: then `previousOrParentTNode` points to previous node (sibling).
|
* - `false`: then `currentTNode` points to previous node (sibling).
|
||||||
*/
|
*/
|
||||||
isParent: boolean;
|
isParent: boolean;
|
||||||
|
|
||||||
|
@ -262,24 +262,24 @@ export function ɵɵrestoreView(viewToRestore: OpaqueViewState) {
|
||||||
instructionState.lFrame.contextLView = viewToRestore as any as LView;
|
instructionState.lFrame.contextLView = viewToRestore as any as LView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPreviousOrParentTNode(): TNode|null {
|
export function getCurrentTNode(): TNode|null {
|
||||||
return instructionState.lFrame.previousOrParentTNode;
|
return instructionState.lFrame.currentTNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setPreviousOrParentTNode(tNode: TNode, isParent: boolean) {
|
export function setCurrentTNode(tNode: TNode, isParent: boolean) {
|
||||||
ngDevMode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
|
ngDevMode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
|
||||||
instructionState.lFrame.previousOrParentTNode = tNode;
|
instructionState.lFrame.currentTNode = tNode;
|
||||||
instructionState.lFrame.isParent = isParent;
|
instructionState.lFrame.isParent = isParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getIsParent(): boolean {
|
export function isCurrentTNodeParent(): boolean {
|
||||||
return instructionState.lFrame.isParent;
|
return instructionState.lFrame.isParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setIsNotParent(): void {
|
export function setCurrentTNodeAsNotParent(): void {
|
||||||
instructionState.lFrame.isParent = false;
|
instructionState.lFrame.isParent = false;
|
||||||
}
|
}
|
||||||
export function setIsParent(): void {
|
export function setCurrentTNodeAsParent(): void {
|
||||||
instructionState.lFrame.isParent = true;
|
instructionState.lFrame.isParent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ export function enterDI(newView: LView, tNode: TNode) {
|
||||||
ngDevMode && assertLViewOrUndefined(newView);
|
ngDevMode && assertLViewOrUndefined(newView);
|
||||||
const newLFrame = allocLFrame();
|
const newLFrame = allocLFrame();
|
||||||
instructionState.lFrame = newLFrame;
|
instructionState.lFrame = newLFrame;
|
||||||
newLFrame.previousOrParentTNode = tNode!;
|
newLFrame.currentTNode = tNode!;
|
||||||
newLFrame.lView = newView;
|
newLFrame.lView = newView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ export function enterView(newView: LView): void {
|
||||||
const tView = newView[TVIEW];
|
const tView = newView[TVIEW];
|
||||||
instructionState.lFrame = newLFrame;
|
instructionState.lFrame = newLFrame;
|
||||||
ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
|
ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
|
||||||
newLFrame.previousOrParentTNode = tView.firstChild!;
|
newLFrame.currentTNode = tView.firstChild!;
|
||||||
newLFrame.lView = newView;
|
newLFrame.lView = newView;
|
||||||
newLFrame.tView = tView;
|
newLFrame.tView = tView;
|
||||||
newLFrame.contextLView = newView!;
|
newLFrame.contextLView = newView!;
|
||||||
|
@ -440,20 +440,20 @@ function allocLFrame() {
|
||||||
|
|
||||||
function createLFrame(parent: LFrame|null): LFrame {
|
function createLFrame(parent: LFrame|null): LFrame {
|
||||||
const lFrame: LFrame = {
|
const lFrame: LFrame = {
|
||||||
previousOrParentTNode: null, //
|
currentTNode: null, //
|
||||||
isParent: true, //
|
isParent: true, //
|
||||||
lView: null!, //
|
lView: null!, //
|
||||||
tView: null!, //
|
tView: null!, //
|
||||||
selectedIndex: 0, //
|
selectedIndex: 0, //
|
||||||
contextLView: null!, //
|
contextLView: null!, //
|
||||||
elementDepthCount: 0, //
|
elementDepthCount: 0, //
|
||||||
currentNamespace: null, //
|
currentNamespace: null, //
|
||||||
currentDirectiveIndex: -1, //
|
currentDirectiveIndex: -1, //
|
||||||
bindingRootIndex: -1, //
|
bindingRootIndex: -1, //
|
||||||
bindingIndex: -1, //
|
bindingIndex: -1, //
|
||||||
currentQueryIndex: 0, //
|
currentQueryIndex: 0, //
|
||||||
parent: parent!, //
|
parent: parent!, //
|
||||||
child: null, //
|
child: null, //
|
||||||
};
|
};
|
||||||
parent !== null && (parent.child = lFrame); // link the new LFrame for reuse.
|
parent !== null && (parent.child = lFrame); // link the new LFrame for reuse.
|
||||||
return lFrame;
|
return lFrame;
|
||||||
|
@ -462,7 +462,7 @@ function createLFrame(parent: LFrame|null): LFrame {
|
||||||
/**
|
/**
|
||||||
* A lightweight version of leave which is used with DI.
|
* A lightweight version of leave which is used with DI.
|
||||||
*
|
*
|
||||||
* This function only resets `previousOrParentTNode` and `LView` as those are the only properties
|
* This function only resets `currentTNode` and `LView` as those are the only properties
|
||||||
* used with DI (`enterDI()`).
|
* used with DI (`enterDI()`).
|
||||||
*
|
*
|
||||||
* NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where
|
* NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where
|
||||||
|
@ -471,7 +471,7 @@ function createLFrame(parent: LFrame|null): LFrame {
|
||||||
function leaveViewLight(): LFrame {
|
function leaveViewLight(): LFrame {
|
||||||
const oldLFrame = instructionState.lFrame;
|
const oldLFrame = instructionState.lFrame;
|
||||||
instructionState.lFrame = oldLFrame.parent;
|
instructionState.lFrame = oldLFrame.parent;
|
||||||
oldLFrame.previousOrParentTNode = null!;
|
oldLFrame.currentTNode = null!;
|
||||||
oldLFrame.lView = null!;
|
oldLFrame.lView = null!;
|
||||||
return oldLFrame;
|
return oldLFrame;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,33 +6,33 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectorRef as ViewEngine_ChangeDetectorRef } from '../change_detection/change_detector_ref';
|
import {ChangeDetectorRef as ViewEngine_ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||||
import { Injector } from '../di/injector';
|
import {Injector} from '../di/injector';
|
||||||
import { ComponentFactory as viewEngine_ComponentFactory, ComponentRef as viewEngine_ComponentRef } from '../linker/component_factory';
|
import {ComponentFactory as viewEngine_ComponentFactory, ComponentRef as viewEngine_ComponentRef} from '../linker/component_factory';
|
||||||
import { ElementRef as ViewEngine_ElementRef } from '../linker/element_ref';
|
import {ElementRef as ViewEngine_ElementRef} from '../linker/element_ref';
|
||||||
import { NgModuleRef as viewEngine_NgModuleRef } from '../linker/ng_module_factory';
|
import {NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory';
|
||||||
import { TemplateRef as ViewEngine_TemplateRef } from '../linker/template_ref';
|
import {TemplateRef as ViewEngine_TemplateRef} from '../linker/template_ref';
|
||||||
import { ViewContainerRef as ViewEngine_ViewContainerRef } from '../linker/view_container_ref';
|
import {ViewContainerRef as ViewEngine_ViewContainerRef} from '../linker/view_container_ref';
|
||||||
import { EmbeddedViewRef as viewEngine_EmbeddedViewRef, ViewRef as viewEngine_ViewRef } from '../linker/view_ref';
|
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef, ViewRef as viewEngine_ViewRef} from '../linker/view_ref';
|
||||||
import { Renderer2 } from '../render/api';
|
import {Renderer2} from '../render/api';
|
||||||
import { addToArray, removeFromArray } from '../util/array_utils';
|
import {addToArray, removeFromArray} from '../util/array_utils';
|
||||||
import { assertDefined, assertEqual, assertGreaterThan, assertLessThan } from '../util/assert';
|
import {assertDefined, assertEqual, assertGreaterThan, assertLessThan} from '../util/assert';
|
||||||
import { assertLContainer, assertNodeInjector } from './assert';
|
|
||||||
import { getParentInjectorLocation, NodeInjector } from './di';
|
|
||||||
import { addToViewTree, createLContainer, createLView, renderView } from './instructions/shared';
|
|
||||||
import { CONTAINER_HEADER_OFFSET, LContainer, NATIVE, VIEW_REFS } from './interfaces/container';
|
|
||||||
import { TNODE } from './interfaces/injector';
|
|
||||||
import { TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNode, TNodeType } from './interfaces/node';
|
|
||||||
import { isProceduralRenderer, RComment, RElement } from './interfaces/renderer';
|
|
||||||
import { isComponentHost, isLContainer, isLView, isRootView } from './interfaces/type_checks';
|
|
||||||
import { DECLARATION_COMPONENT_VIEW, DECLARATION_LCONTAINER, LView, LViewFlags, PARENT, QUERIES, RENDERER, TVIEW, TView, T_HOST } from './interfaces/view';
|
|
||||||
import { assertNodeOfPossibleTypes } from './node_assert';
|
|
||||||
import { addViewToContainer, appendChild, destroyLView, detachView, getBeforeNodeForView, insertView, nativeInsertBefore, nativeNextSibling, nativeParentNode } from './node_manipulation';
|
|
||||||
import { getLView, getPreviousOrParentTNode } from './state';
|
|
||||||
import { getParentInjectorIndex, getParentInjectorView, hasParentInjector } from './util/injector_utils';
|
|
||||||
import { getComponentLViewByIndex, getNativeByTNode, unwrapRNode, viewAttachedToContainer } from './util/view_utils';
|
|
||||||
import { ViewRef } from './view_ref';
|
|
||||||
|
|
||||||
|
import {assertLContainer, assertNodeInjector} from './assert';
|
||||||
|
import {getParentInjectorLocation, NodeInjector} from './di';
|
||||||
|
import {addToViewTree, createLContainer, createLView, renderView} from './instructions/shared';
|
||||||
|
import {CONTAINER_HEADER_OFFSET, LContainer, NATIVE, VIEW_REFS} from './interfaces/container';
|
||||||
|
import {TNODE} from './interfaces/injector';
|
||||||
|
import {TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNode, TNodeType} from './interfaces/node';
|
||||||
|
import {isProceduralRenderer, RComment, RElement} from './interfaces/renderer';
|
||||||
|
import {isComponentHost, isLContainer, isLView, isRootView} from './interfaces/type_checks';
|
||||||
|
import {DECLARATION_COMPONENT_VIEW, DECLARATION_LCONTAINER, LView, LViewFlags, PARENT, QUERIES, RENDERER, T_HOST, TVIEW, TView} from './interfaces/view';
|
||||||
|
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||||
|
import {addViewToContainer, appendChild, destroyLView, detachView, getBeforeNodeForView, insertView, nativeInsertBefore, nativeNextSibling, nativeParentNode} from './node_manipulation';
|
||||||
|
import {getCurrentTNode, getLView} from './state';
|
||||||
|
import {getParentInjectorIndex, getParentInjectorView, hasParentInjector} from './util/injector_utils';
|
||||||
|
import {getComponentLViewByIndex, getNativeByTNode, unwrapRNode, viewAttachedToContainer} from './util/view_utils';
|
||||||
|
import {ViewRef} from './view_ref';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ import { ViewRef } from './view_ref';
|
||||||
*/
|
*/
|
||||||
export function injectElementRef(ElementRefToken: typeof ViewEngine_ElementRef):
|
export function injectElementRef(ElementRefToken: typeof ViewEngine_ElementRef):
|
||||||
ViewEngine_ElementRef {
|
ViewEngine_ElementRef {
|
||||||
return createElementRef(ElementRefToken, getPreviousOrParentTNode()!, getLView());
|
return createElementRef(ElementRefToken, getCurrentTNode()!, getLView());
|
||||||
}
|
}
|
||||||
|
|
||||||
let R3ElementRef: {new (native: RElement|RComment): ViewEngine_ElementRef};
|
let R3ElementRef: {new (native: RElement|RComment): ViewEngine_ElementRef};
|
||||||
|
@ -78,8 +78,7 @@ let R3TemplateRef: {
|
||||||
export function injectTemplateRef<T>(
|
export function injectTemplateRef<T>(
|
||||||
TemplateRefToken: typeof ViewEngine_TemplateRef,
|
TemplateRefToken: typeof ViewEngine_TemplateRef,
|
||||||
ElementRefToken: typeof ViewEngine_ElementRef): ViewEngine_TemplateRef<T>|null {
|
ElementRefToken: typeof ViewEngine_ElementRef): ViewEngine_TemplateRef<T>|null {
|
||||||
return createTemplateRef<T>(
|
return createTemplateRef<T>(TemplateRefToken, ElementRefToken, getCurrentTNode()!, getLView());
|
||||||
TemplateRefToken, ElementRefToken, getPreviousOrParentTNode()!, getLView());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,8 +148,7 @@ let R3ViewContainerRef: {
|
||||||
export function injectViewContainerRef(
|
export function injectViewContainerRef(
|
||||||
ViewContainerRefToken: typeof ViewEngine_ViewContainerRef,
|
ViewContainerRefToken: typeof ViewEngine_ViewContainerRef,
|
||||||
ElementRefToken: typeof ViewEngine_ElementRef): ViewEngine_ViewContainerRef {
|
ElementRefToken: typeof ViewEngine_ElementRef): ViewEngine_ViewContainerRef {
|
||||||
const previousTNode =
|
const previousTNode = getCurrentTNode() as TElementNode | TElementContainerNode | TContainerNode;
|
||||||
getPreviousOrParentTNode() as TElementNode | TElementContainerNode | TContainerNode;
|
|
||||||
return createContainerRef(ViewContainerRefToken, ElementRefToken, previousTNode, getLView());
|
return createContainerRef(ViewContainerRefToken, ElementRefToken, previousTNode, getLView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +405,7 @@ export function createContainerRef(
|
||||||
|
|
||||||
/** Returns a ChangeDetectorRef (a.k.a. a ViewRef) */
|
/** Returns a ChangeDetectorRef (a.k.a. a ViewRef) */
|
||||||
export function injectChangeDetectorRef(isPipe = false): ViewEngine_ChangeDetectorRef {
|
export function injectChangeDetectorRef(isPipe = false): ViewEngine_ChangeDetectorRef {
|
||||||
return createViewRef(getPreviousOrParentTNode()!, getLView(), isPipe);
|
return createViewRef(getCurrentTNode()!, getLView(), isPipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -453,7 +451,7 @@ export function injectRenderer2(): Renderer2 {
|
||||||
// We need the Renderer to be based on the component that it's being injected into, however since
|
// We need the Renderer to be based on the component that it's being injected into, however since
|
||||||
// DI happens before we've entered its view, `getLView` will return the parent view instead.
|
// DI happens before we've entered its view, `getLView` will return the parent view instead.
|
||||||
const lView = getLView();
|
const lView = getLView();
|
||||||
const tNode = getPreviousOrParentTNode()!;
|
const tNode = getCurrentTNode()!;
|
||||||
const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
||||||
return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
|
return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -687,7 +687,7 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
|
||||||
'(lView[0] as Element).appendChild(lView[2])',
|
'(lView[0] as Element).appendChild(lView[2])',
|
||||||
'lView[4] = document.createTextNode("World")',
|
'lView[4] = document.createTextNode("World")',
|
||||||
'(lView[2] as Element).appendChild(lView[4])',
|
'(lView[2] as Element).appendChild(lView[4])',
|
||||||
'setPreviousOrParentTNode(tView.data[2] as TNode)',
|
'setCurrentTNode(tView.data[2] as TNode)',
|
||||||
'lView[5] = document.createTextNode("!")',
|
'lView[5] = document.createTextNode("!")',
|
||||||
'(lView[0] as Element).appendChild(lView[5])',
|
'(lView[0] as Element).appendChild(lView[5])',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -171,10 +171,10 @@
|
||||||
"name": "getConstant"
|
"name": "getConstant"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getFirstLContainer"
|
"name": "getCurrentTNode"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getIsParent"
|
"name": "getFirstLContainer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getLView"
|
"name": "getLView"
|
||||||
|
@ -200,9 +200,6 @@
|
||||||
{
|
{
|
||||||
"name": "getOrCreateTNode"
|
"name": "getOrCreateTNode"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getSimpleChangesStore"
|
"name": "getSimpleChangesStore"
|
||||||
},
|
},
|
||||||
|
@ -245,6 +242,9 @@
|
||||||
{
|
{
|
||||||
"name": "isCssClassMatching"
|
"name": "isCssClassMatching"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isCurrentTNodeParent"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isInlineTemplate"
|
"name": "isInlineTemplate"
|
||||||
},
|
},
|
||||||
|
@ -323,6 +323,9 @@
|
||||||
{
|
{
|
||||||
"name": "setCurrentQueryIndex"
|
"name": "setCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "setCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "setDirectiveInputsWhichShadowsStyling"
|
"name": "setDirectiveInputsWhichShadowsStyling"
|
||||||
},
|
},
|
||||||
|
@ -335,9 +338,6 @@
|
||||||
{
|
{
|
||||||
"name": "setInputsFromAttrs"
|
"name": "setInputsFromAttrs"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "setPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setSelectedIndex"
|
"name": "setSelectedIndex"
|
||||||
},
|
},
|
||||||
|
|
|
@ -965,6 +965,9 @@
|
||||||
{
|
{
|
||||||
"name": "getConstant"
|
"name": "getConstant"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "getCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "getDOM"
|
"name": "getDOM"
|
||||||
},
|
},
|
||||||
|
@ -986,9 +989,6 @@
|
||||||
{
|
{
|
||||||
"name": "getInjectorIndex"
|
"name": "getInjectorIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getIsParent"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getLCleanup"
|
"name": "getLCleanup"
|
||||||
},
|
},
|
||||||
|
@ -1052,9 +1052,6 @@
|
||||||
{
|
{
|
||||||
"name": "getPreviousIndex"
|
"name": "getPreviousIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getPromiseCtor"
|
"name": "getPromiseCtor"
|
||||||
},
|
},
|
||||||
|
@ -1172,6 +1169,9 @@
|
||||||
{
|
{
|
||||||
"name": "isCssClassMatching"
|
"name": "isCssClassMatching"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isCurrentTNodeParent"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isDirectiveHost"
|
"name": "isDirectiveHost"
|
||||||
},
|
},
|
||||||
|
@ -1499,6 +1499,9 @@
|
||||||
{
|
{
|
||||||
"name": "setCurrentQueryIndex"
|
"name": "setCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "setCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "setDirectiveInputsWhichShadowsStyling"
|
"name": "setDirectiveInputsWhichShadowsStyling"
|
||||||
},
|
},
|
||||||
|
@ -1517,9 +1520,6 @@
|
||||||
{
|
{
|
||||||
"name": "setLocaleId"
|
"name": "setLocaleId"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "setPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setSelectedIndex"
|
"name": "setSelectedIndex"
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,6 +119,9 @@
|
||||||
{
|
{
|
||||||
"name": "getComponentLViewByIndex"
|
"name": "getComponentLViewByIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "getCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "getFirstLContainer"
|
"name": "getFirstLContainer"
|
||||||
},
|
},
|
||||||
|
@ -134,9 +137,6 @@
|
||||||
{
|
{
|
||||||
"name": "getOrCreateTNode"
|
"name": "getOrCreateTNode"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getSimpleChangesStore"
|
"name": "getSimpleChangesStore"
|
||||||
},
|
},
|
||||||
|
@ -206,15 +206,15 @@
|
||||||
{
|
{
|
||||||
"name": "setCurrentQueryIndex"
|
"name": "setCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "setCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "setIncludeViewProviders"
|
"name": "setIncludeViewProviders"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "setInjectImplementation"
|
"name": "setInjectImplementation"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "setPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setSelectedIndex"
|
"name": "setSelectedIndex"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1280,6 +1280,9 @@
|
||||||
{
|
{
|
||||||
"name": "getCurrentQueryIndex"
|
"name": "getCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "getCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "getDOM"
|
"name": "getDOM"
|
||||||
},
|
},
|
||||||
|
@ -1310,9 +1313,6 @@
|
||||||
{
|
{
|
||||||
"name": "getInjectorIndex"
|
"name": "getInjectorIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getIsParent"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getLCleanup"
|
"name": "getLCleanup"
|
||||||
},
|
},
|
||||||
|
@ -1388,9 +1388,6 @@
|
||||||
{
|
{
|
||||||
"name": "getPreviousIndex"
|
"name": "getPreviousIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getPromiseCtor"
|
"name": "getPromiseCtor"
|
||||||
},
|
},
|
||||||
|
@ -1508,6 +1505,9 @@
|
||||||
{
|
{
|
||||||
"name": "isCssClassMatching"
|
"name": "isCssClassMatching"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isCurrentTNodeParent"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isDirectiveHost"
|
"name": "isDirectiveHost"
|
||||||
},
|
},
|
||||||
|
@ -1832,6 +1832,9 @@
|
||||||
{
|
{
|
||||||
"name": "setCurrentQueryIndex"
|
"name": "setCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "setCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "setDirectiveInputsWhichShadowsStyling"
|
"name": "setDirectiveInputsWhichShadowsStyling"
|
||||||
},
|
},
|
||||||
|
@ -1850,9 +1853,6 @@
|
||||||
{
|
{
|
||||||
"name": "setLocaleId"
|
"name": "setLocaleId"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "setPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setRouterState"
|
"name": "setRouterState"
|
||||||
},
|
},
|
||||||
|
|
|
@ -344,6 +344,9 @@
|
||||||
{
|
{
|
||||||
"name": "getConstant"
|
"name": "getConstant"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "getCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "getDebugContext"
|
"name": "getDebugContext"
|
||||||
},
|
},
|
||||||
|
@ -353,9 +356,6 @@
|
||||||
{
|
{
|
||||||
"name": "getInjectorIndex"
|
"name": "getInjectorIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getIsParent"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getLCleanup"
|
"name": "getLCleanup"
|
||||||
},
|
},
|
||||||
|
@ -410,9 +410,6 @@
|
||||||
{
|
{
|
||||||
"name": "getPreviousIndex"
|
"name": "getPreviousIndex"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "getPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "getSelectedIndex"
|
"name": "getSelectedIndex"
|
||||||
},
|
},
|
||||||
|
@ -482,6 +479,9 @@
|
||||||
{
|
{
|
||||||
"name": "isCssClassMatching"
|
"name": "isCssClassMatching"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isCurrentTNodeParent"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isDirectiveHost"
|
"name": "isDirectiveHost"
|
||||||
},
|
},
|
||||||
|
@ -650,6 +650,9 @@
|
||||||
{
|
{
|
||||||
"name": "setCurrentQueryIndex"
|
"name": "setCurrentQueryIndex"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "setCurrentTNode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "setDirectiveInputsWhichShadowsStyling"
|
"name": "setDirectiveInputsWhichShadowsStyling"
|
||||||
},
|
},
|
||||||
|
@ -665,9 +668,6 @@
|
||||||
{
|
{
|
||||||
"name": "setInputsFromAttrs"
|
"name": "setInputsFromAttrs"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "setPreviousOrParentTNode"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "setSelectedIndex"
|
"name": "setSelectedIndex"
|
||||||
},
|
},
|
||||||
|
|
|
@ -128,7 +128,7 @@ describe('i18n debug', () => {
|
||||||
it('should print ElementEnd', () => {
|
it('should print ElementEnd', () => {
|
||||||
expect(i18nMutateOpCodesToString([
|
expect(i18nMutateOpCodesToString([
|
||||||
1 << I18nMutateOpCode.SHIFT_REF | I18nMutateOpCode.ElementEnd,
|
1 << I18nMutateOpCode.SHIFT_REF | I18nMutateOpCode.ElementEnd,
|
||||||
])).toEqual(['setPreviousOrParentTNode(tView.data[1] as TNode)']);
|
])).toEqual(['setCurrentTNode(tView.data[1] as TNode)']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should print RemoveNestedIcu', () => {
|
it('should print RemoveNestedIcu', () => {
|
||||||
|
|
|
@ -112,13 +112,13 @@ describe('Runtime i18n', () => {
|
||||||
'(lView[1] as Element).appendChild(lView[2])',
|
'(lView[1] as Element).appendChild(lView[2])',
|
||||||
'lView[5] = document.createTextNode("world")',
|
'lView[5] = document.createTextNode("world")',
|
||||||
'(lView[2] as Element).appendChild(lView[5])',
|
'(lView[2] as Element).appendChild(lView[5])',
|
||||||
'setPreviousOrParentTNode(tView.data[2] as TNode)',
|
'setCurrentTNode(tView.data[2] as TNode)',
|
||||||
'lView[6] = document.createTextNode(" and ")',
|
'lView[6] = document.createTextNode(" and ")',
|
||||||
'(lView[1] as Element).appendChild(lView[6])',
|
'(lView[1] as Element).appendChild(lView[6])',
|
||||||
'(lView[1] as Element).appendChild(lView[3])',
|
'(lView[1] as Element).appendChild(lView[3])',
|
||||||
'lView[7] = document.createTextNode("universe")',
|
'lView[7] = document.createTextNode("universe")',
|
||||||
'(lView[3] as Element).appendChild(lView[7])',
|
'(lView[3] as Element).appendChild(lView[7])',
|
||||||
'setPreviousOrParentTNode(tView.data[3] as TNode)',
|
'setCurrentTNode(tView.data[3] as TNode)',
|
||||||
'lView[8] = document.createTextNode("!")',
|
'lView[8] = document.createTextNode("!")',
|
||||||
'(lView[1] as Element).appendChild(lView[8])',
|
'(lView[1] as Element).appendChild(lView[8])',
|
||||||
]),
|
]),
|
||||||
|
@ -221,8 +221,7 @@ describe('Runtime i18n', () => {
|
||||||
'(lView[1] as Element).appendChild(lView[3])',
|
'(lView[1] as Element).appendChild(lView[3])',
|
||||||
'(lView[1] as Element).appendChild(lView[16381])',
|
'(lView[1] as Element).appendChild(lView[16381])',
|
||||||
'lView[4] = document.createTextNode("after")',
|
'lView[4] = document.createTextNode("after")',
|
||||||
'(lView[1] as Element).appendChild(lView[4])',
|
'(lView[1] as Element).appendChild(lView[4])', 'setCurrentTNode(tView.data[1] as TNode)'
|
||||||
'setPreviousOrParentTNode(tView.data[1] as TNode)'
|
|
||||||
]),
|
]),
|
||||||
update: [],
|
update: [],
|
||||||
icus: null
|
icus: null
|
||||||
|
@ -242,8 +241,7 @@ describe('Runtime i18n', () => {
|
||||||
create: debugMatch([
|
create: debugMatch([
|
||||||
'(lView[0] as Element).appendChild(lView[1])',
|
'(lView[0] as Element).appendChild(lView[1])',
|
||||||
'lView[2] = document.createTextNode("middle")',
|
'lView[2] = document.createTextNode("middle")',
|
||||||
'(lView[1] as Element).appendChild(lView[2])',
|
'(lView[1] as Element).appendChild(lView[2])', 'setCurrentTNode(tView.data[1] as TNode)'
|
||||||
'setPreviousOrParentTNode(tView.data[1] as TNode)'
|
|
||||||
]),
|
]),
|
||||||
update: [],
|
update: [],
|
||||||
icus: null
|
icus: null
|
||||||
|
|
|
@ -236,7 +236,7 @@ export function resetDOM() {
|
||||||
containerEl.setAttribute('host', '');
|
containerEl.setAttribute('host', '');
|
||||||
document.body.appendChild(containerEl);
|
document.body.appendChild(containerEl);
|
||||||
hostView = null;
|
hostView = null;
|
||||||
// TODO: assert that the global state is clean (e.g. ngData, previousOrParentNode, etc)
|
// TODO: assert that the global state is clean (e.g. ngData, currentTNode, etc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue