@@ -12,6 +12,7 @@ import {validateAgainstEventAttributes, validateAgainstEventProperties} from '..
1212import { Sanitizer } from '../../sanitization/sanitizer' ;
1313import { assertDataInRange , assertDefined , assertDomNode , assertEqual , assertGreaterThan , assertNotEqual , assertNotSame } from '../../util/assert' ;
1414import { createNamedArrayType } from '../../util/named_array_type' ;
15+ import { initNgDevMode } from '../../util/ng_dev_mode' ;
1516import { normalizeDebugBindingName , normalizeDebugBindingValue } from '../../util/ng_reflect' ;
1617import { assertFirstTemplatePass , assertLView } from '../assert' ;
1718import { attachPatchData , getComponentViewByInstance } from '../context_discovery' ;
@@ -656,7 +657,7 @@ export function createTView(
656657}
657658
658659function createViewBlueprint ( bindingStartIndex : number , initialViewLength : number ) : LView {
659- const blueprint = ngDevMode ? new LViewBlueprint ! ( ) : [ ] ;
660+ const blueprint = ngDevMode ? new LViewBlueprint ( ) : [ ] ;
660661
661662 for ( let i = 0 ; i < initialViewLength ; i ++ ) {
662663 blueprint . push ( i < bindingStartIndex ? null : NO_CHANGE ) ;
@@ -1187,7 +1188,7 @@ function findDirectiveMatches(
11871188 for ( let i = 0 ; i < registry . length ; i ++ ) {
11881189 const def = registry [ i ] as ComponentDef < any > | DirectiveDef < any > ;
11891190 if ( isNodeMatchingSelectorList ( tNode , def . selectors ! , /* isProjectionMode */ false ) ) {
1190- matches || ( matches = ngDevMode ? new MatchesArray ! ( ) : [ ] ) ;
1191+ matches || ( matches = ngDevMode ? new MatchesArray ( ) : [ ] ) ;
11911192 diPublicInInjector ( getOrCreateNodeInjectorForNode ( tNode , viewData ) , tView , def . type ) ;
11921193
11931194 if ( isComponentDef ( def ) ) {
@@ -1212,7 +1213,7 @@ function findDirectiveMatches(
12121213export function markAsComponentHost ( tView : TView , hostTNode : TNode ) : void {
12131214 ngDevMode && assertFirstTemplatePass ( tView ) ;
12141215 hostTNode . flags = TNodeFlags . isComponentHost ;
1215- ( tView . components || ( tView . components = ngDevMode ? new TViewComponents ! ( ) : [
1216+ ( tView . components || ( tView . components = ngDevMode ? new TViewComponents ( ) : [
12161217 ] ) ) . push ( hostTNode . index ) ;
12171218}
12181219
@@ -1222,7 +1223,7 @@ function cacheMatchingLocalNames(
12221223 tNode : TNode , localRefs : string [ ] | null , exportsMap : { [ key : string ] : number } ) : void {
12231224 if ( localRefs ) {
12241225 const localNames : ( string | number ) [ ] = tNode . localNames =
1225- ngDevMode ? new TNodeLocalNames ! ( ) : [ ] ;
1226+ ngDevMode ? new TNodeLocalNames ( ) : [ ] ;
12261227
12271228 // Local names must be stored in tNode in the same order that localRefs are defined
12281229 // in the template to ensure the data is loaded in the same slots as their refs
@@ -1380,7 +1381,7 @@ function setInputsFromAttrs<T>(
13801381function generateInitialInputs (
13811382 directiveIndex : number , inputs : { [ key : string ] : string } , tNode : TNode ) : InitialInputData {
13821383 const initialInputData : InitialInputData =
1383- tNode . initialInputs || ( tNode . initialInputs = ngDevMode ? new TNodeInitialInputs ! ( ) : [ ] ) ;
1384+ tNode . initialInputs || ( tNode . initialInputs = ngDevMode ? new TNodeInitialInputs ( ) : [ ] ) ;
13841385 // Ensure that we don't create sparse arrays
13851386 for ( let i = initialInputData . length ; i <= directiveIndex ; i ++ ) {
13861387 initialInputData . push ( null ) ;
@@ -1408,7 +1409,7 @@ function generateInitialInputs(
14081409
14091410 if ( minifiedInputName !== undefined ) {
14101411 const inputsToStore : InitialInputs = initialInputData [ directiveIndex ] ||
1411- ( initialInputData [ directiveIndex ] = ngDevMode ? new TNodeInitialData ! ( ) : [ ] ) ;
1412+ ( initialInputData [ directiveIndex ] = ngDevMode ? new TNodeInitialData ( ) : [ ] ) ;
14121413 inputsToStore . push ( attrName as string , minifiedInputName , attrValue as string ) ;
14131414 }
14141415
@@ -1422,7 +1423,8 @@ function generateInitialInputs(
14221423//////////////////////////
14231424
14241425// Not sure why I need to do `any` here but TS complains later.
1425- const LContainerArray : any = ngDevMode && createNamedArrayType ( 'LContainer' ) ;
1426+ const LContainerArray : any = ( ( typeof ngDevMode === 'undefined' || ngDevMode ) && initNgDevMode ( ) ) &&
1427+ createNamedArrayType ( 'LContainer' ) ;
14261428
14271429/**
14281430 * Creates a LContainer, either from a container instruction, or for a ViewContainerRef.
@@ -1777,11 +1779,11 @@ export function initializeTNodeInputs(tView: TView, tNode: TNode): PropertyAlias
17771779
17781780export function getCleanup ( view : LView ) : any [ ] {
17791781 // top level variables should not be exported for performance reasons (PERF_NOTES.md)
1780- return view [ CLEANUP ] || ( view [ CLEANUP ] = ngDevMode ? new LCleanup ! ( ) : [ ] ) ;
1782+ return view [ CLEANUP ] || ( view [ CLEANUP ] = ngDevMode ? new LCleanup ( ) : [ ] ) ;
17811783}
17821784
17831785function getTViewCleanup ( view : LView ) : any [ ] {
1784- return view [ TVIEW ] . cleanup || ( view [ TVIEW ] . cleanup = ngDevMode ? new TCleanup ! ( ) : [ ] ) ;
1786+ return view [ TVIEW ] . cleanup || ( view [ TVIEW ] . cleanup = ngDevMode ? new TCleanup ( ) : [ ] ) ;
17851787}
17861788
17871789/**
0 commit comments