@@ -27,7 +27,7 @@ import {AttributeMarker, InitialInputData, InitialInputs, LocalRefExtractor, Pro
2727import { RComment , RElement , RNode , RText , Renderer3 , RendererFactory3 , isProceduralRenderer } from '../interfaces/renderer' ;
2828import { SanitizerFn } from '../interfaces/sanitization' ;
2929import { isComponentDef , isComponentHost , isContentQueryHost , isLContainer , isRootView } from '../interfaces/type_checks' ;
30- import { CHILD_HEAD , CHILD_TAIL , CLEANUP , CONTEXT , DECLARATION_VIEW , ExpandoInstructions , FLAGS , HEADER_OFFSET , HOST , INJECTOR , InitPhaseState , LView , LViewFlags , NEXT , PARENT , RENDERER , RENDERER_FACTORY , RootContext , RootContextFlags , SANITIZER , TData , TVIEW , TView , T_HOST } from '../interfaces/view' ;
30+ import { CHILD_HEAD , CHILD_TAIL , CLEANUP , CONTEXT , DECLARATION_VIEW , ExpandoInstructions , FLAGS , HEADER_OFFSET , HOST , INJECTOR , InitPhaseState , LView , LViewFlags , NEXT , PARENT , RENDERER , RENDERER_FACTORY , RootContext , RootContextFlags , SANITIZER , TData , TVIEW , TView , TViewType , T_HOST } from '../interfaces/view' ;
3131import { assertNodeOfPossibleTypes } from '../node_assert' ;
3232import { isNodeMatchingSelectorList } from '../node_selector_matcher' ;
3333import { ActiveElementFlags , enterView , executeElementExitFn , getBindingIndex , getBindingsEnabled , getCheckNoChangesMode , getIsParent , getPreviousOrParentTNode , getSelectedIndex , hasActiveElementFlag , incrementActiveDirectiveId , leaveView , leaveViewProcessExit , setActiveHostElement , setBindingIndex , setBindingRoot , setCheckNoChangesMode , setCurrentDirectiveDef , setCurrentQueryIndex , setPreviousOrParentTNode , setSelectedIndex } from '../state' ;
@@ -40,7 +40,7 @@ import {getLViewParent} from '../util/view_traversal_utils';
4040import { getComponentLViewByIndex , getNativeByIndex , getNativeByTNode , getTNode , isCreationMode , readPatchedLView , resetPreOrderHookFlags , unwrapRNode , viewAttachedToChangeDetector } from '../util/view_utils' ;
4141
4242import { selectIndexInternal } from './advance' ;
43- import { LCleanup , LViewBlueprint , MatchesArray , TCleanup , TNodeConstructor , TNodeInitialInputs , TNodeLocalNames , TViewComponents , TViewConstructor , attachLContainerDebug , attachLViewDebug , cloneToLView , cloneToTViewData } from './lview_debug' ;
43+ import { LCleanup , LViewBlueprint , MatchesArray , TCleanup , TNodeConstructor , TNodeInitialInputs , TNodeLocalNames , TViewComponents , TViewConstructor , attachLContainerDebug , attachLViewDebug , cloneToLViewFromTViewBlueprint , cloneToTViewData } from './lview_debug' ;
4444
4545
4646
@@ -158,7 +158,8 @@ export function createLView<T>(
158158 host : RElement | null , tHostNode : TViewNode | TElementNode | null ,
159159 rendererFactory ?: RendererFactory3 | null , renderer ?: Renderer3 | null ,
160160 sanitizer ?: Sanitizer | null , injector ?: Injector | null ) : LView {
161- const lView = ngDevMode ? cloneToLView ( tView . blueprint ) : tView . blueprint . slice ( ) as LView ;
161+ const lView =
162+ ngDevMode ? cloneToLViewFromTViewBlueprint ( tView ) : tView . blueprint . slice ( ) as LView ;
162163 lView [ HOST ] = host ;
163164 lView [ FLAGS ] = flags | LViewFlags . CreationMode | LViewFlags . Attached | LViewFlags . FirstLViewPass ;
164165 resetPreOrderHookFlags ( lView ) ;
@@ -568,10 +569,11 @@ export function saveResolvedLocalsInData(
568569 * @param def ComponentDef
569570 * @returns TView
570571 */
571- export function getOrCreateTView ( def : ComponentDef < any > ) : TView {
572- return def . tView || ( def . tView = createTView (
573- - 1 , def . template , def . decls , def . vars , def . directiveDefs , def . pipeDefs ,
574- def . viewQuery , def . schemas , def . consts ) ) ;
572+ export function getOrCreateTComponentView ( def : ComponentDef < any > ) : TView {
573+ return def . tView ||
574+ ( def . tView = createTView (
575+ TViewType . Component , - 1 , def . template , def . decls , def . vars , def . directiveDefs ,
576+ def . pipeDefs , def . viewQuery , def . schemas , def . consts ) ) ;
575577}
576578
577579
@@ -588,8 +590,8 @@ export function getOrCreateTView(def: ComponentDef<any>): TView {
588590 * @param consts Constants for this view
589591 */
590592export function createTView (
591- viewIndex : number , templateFn : ComponentTemplate < any > | null , decls : number , vars : number ,
592- directives : DirectiveDefListOrFactory | null , pipes : PipeDefListOrFactory | null ,
593+ type : TViewType , viewIndex : number , templateFn : ComponentTemplate < any > | null , decls : number ,
594+ vars : number , directives : DirectiveDefListOrFactory | null , pipes : PipeDefListOrFactory | null ,
593595 viewQuery : ViewQueriesFunction < any > | null , schemas : SchemaMetadata [ ] | null ,
594596 consts : TConstants | null ) : TView {
595597 ngDevMode && ngDevMode . tView ++ ;
@@ -601,6 +603,7 @@ export function createTView(
601603 const blueprint = createViewBlueprint ( bindingStartIndex , initialViewLength ) ;
602604 return blueprint [ TVIEW as any ] = ngDevMode ?
603605 new TViewConstructor (
606+ type ,
604607 viewIndex , // id: number,
605608 blueprint , // blueprint: LView,
606609 templateFn , // template: ComponentTemplate<{}>|null,
@@ -1304,7 +1307,7 @@ function baseResolveDirective<T>(tView: TView, viewData: LView, def: DirectiveDe
13041307
13051308function addComponentLogic < T > ( lView : LView , hostTNode : TElementNode , def : ComponentDef < T > ) : void {
13061309 const native = getNativeByTNode ( hostTNode , lView ) as RElement ;
1307- const tView = getOrCreateTView ( def ) ;
1310+ const tView = getOrCreateTComponentView ( def ) ;
13081311
13091312 // Only component views should be added to the view tree directly. Embedded views are
13101313 // accessed through their containers because they may be removed / re-added later.
0 commit comments