1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { assertDefined, assertEqual, assertNumber, throwError } from '../util/assert';
|
---|
9 | import { getComponentDef, getNgModuleDef } from './definition';
|
---|
10 | import { isLContainer, isLView } from './interfaces/type_checks';
|
---|
11 | import { DECLARATION_COMPONENT_VIEW, HEADER_OFFSET, T_HOST, TVIEW } from './interfaces/view';
|
---|
12 | // [Assert functions do not constraint type when they are guarded by a truthy
|
---|
13 | // expression.](https://github.com/microsoft/TypeScript/issues/37295)
|
---|
14 | export function assertTNodeForLView(tNode, lView) {
|
---|
15 | assertTNodeForTView(tNode, lView[TVIEW]);
|
---|
16 | }
|
---|
17 | export function assertTNodeForTView(tNode, tView) {
|
---|
18 | assertTNode(tNode);
|
---|
19 | tNode.hasOwnProperty('tView_') &&
|
---|
20 | assertEqual(tNode.tView_, tView, 'This TNode does not belong to this TView.');
|
---|
21 | }
|
---|
22 | export function assertTNode(tNode) {
|
---|
23 | assertDefined(tNode, 'TNode must be defined');
|
---|
24 | if (!(tNode && typeof tNode === 'object' && tNode.hasOwnProperty('directiveStylingLast'))) {
|
---|
25 | throwError('Not of type TNode, got: ' + tNode);
|
---|
26 | }
|
---|
27 | }
|
---|
28 | export function assertTIcu(tIcu) {
|
---|
29 | assertDefined(tIcu, 'Expected TIcu to be defined');
|
---|
30 | if (!(typeof tIcu.currentCaseLViewIndex === 'number')) {
|
---|
31 | throwError('Object is not of TIcu type.');
|
---|
32 | }
|
---|
33 | }
|
---|
34 | export function assertComponentType(actual, msg = 'Type passed in is not ComponentType, it does not have \'ɵcmp\' property.') {
|
---|
35 | if (!getComponentDef(actual)) {
|
---|
36 | throwError(msg);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | export function assertNgModuleType(actual, msg = 'Type passed in is not NgModuleType, it does not have \'ɵmod\' property.') {
|
---|
40 | if (!getNgModuleDef(actual)) {
|
---|
41 | throwError(msg);
|
---|
42 | }
|
---|
43 | }
|
---|
44 | export function assertCurrentTNodeIsParent(isParent) {
|
---|
45 | assertEqual(isParent, true, 'currentTNode should be a parent');
|
---|
46 | }
|
---|
47 | export function assertHasParent(tNode) {
|
---|
48 | assertDefined(tNode, 'currentTNode should exist!');
|
---|
49 | assertDefined(tNode.parent, 'currentTNode should have a parent');
|
---|
50 | }
|
---|
51 | export function assertDataNext(lView, index, arr) {
|
---|
52 | if (arr == null)
|
---|
53 | arr = lView;
|
---|
54 | assertEqual(arr.length, index, `index ${index} expected to be at the end of arr (length ${arr.length})`);
|
---|
55 | }
|
---|
56 | export function assertLContainer(value) {
|
---|
57 | assertDefined(value, 'LContainer must be defined');
|
---|
58 | assertEqual(isLContainer(value), true, 'Expecting LContainer');
|
---|
59 | }
|
---|
60 | export function assertLViewOrUndefined(value) {
|
---|
61 | value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');
|
---|
62 | }
|
---|
63 | export function assertLView(value) {
|
---|
64 | assertDefined(value, 'LView must be defined');
|
---|
65 | assertEqual(isLView(value), true, 'Expecting LView');
|
---|
66 | }
|
---|
67 | export function assertFirstCreatePass(tView, errMessage) {
|
---|
68 | assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');
|
---|
69 | }
|
---|
70 | export function assertFirstUpdatePass(tView, errMessage) {
|
---|
71 | assertEqual(tView.firstUpdatePass, true, errMessage || 'Should only be called in first update pass.');
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * This is a basic sanity check that an object is probably a directive def. DirectiveDef is
|
---|
75 | * an interface, so we can't do a direct instanceof check.
|
---|
76 | */
|
---|
77 | export function assertDirectiveDef(obj) {
|
---|
78 | if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {
|
---|
79 | throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
|
---|
80 | }
|
---|
81 | }
|
---|
82 | export function assertIndexInDeclRange(lView, index) {
|
---|
83 | const tView = lView[1];
|
---|
84 | assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
|
---|
85 | }
|
---|
86 | export function assertIndexInVarsRange(lView, index) {
|
---|
87 | const tView = lView[1];
|
---|
88 | assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
|
---|
89 | }
|
---|
90 | export function assertIndexInExpandoRange(lView, index) {
|
---|
91 | const tView = lView[1];
|
---|
92 | assertBetween(tView.expandoStartIndex, lView.length, index);
|
---|
93 | }
|
---|
94 | export function assertBetween(lower, upper, index) {
|
---|
95 | if (!(lower <= index && index < upper)) {
|
---|
96 | throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
|
---|
97 | }
|
---|
98 | }
|
---|
99 | export function assertProjectionSlots(lView, errMessage) {
|
---|
100 | assertDefined(lView[DECLARATION_COMPONENT_VIEW], 'Component views should exist.');
|
---|
101 | assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage ||
|
---|
102 | 'Components with projection nodes (<ng-content>) must have projection slots defined.');
|
---|
103 | }
|
---|
104 | export function assertParentView(lView, errMessage) {
|
---|
105 | assertDefined(lView, errMessage || 'Component views should always have a parent view (component\'s host view)');
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * This is a basic sanity check that the `injectorIndex` seems to point to what looks like a
|
---|
109 | * NodeInjector data structure.
|
---|
110 | *
|
---|
111 | * @param lView `LView` which should be checked.
|
---|
112 | * @param injectorIndex index into the `LView` where the `NodeInjector` is expected.
|
---|
113 | */
|
---|
114 | export function assertNodeInjector(lView, injectorIndex) {
|
---|
115 | assertIndexInExpandoRange(lView, injectorIndex);
|
---|
116 | assertIndexInExpandoRange(lView, injectorIndex + 8 /* PARENT */);
|
---|
117 | assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');
|
---|
118 | assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');
|
---|
119 | assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');
|
---|
120 | assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');
|
---|
121 | assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');
|
---|
122 | assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');
|
---|
123 | assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');
|
---|
124 | assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');
|
---|
125 | assertNumber(lView[injectorIndex + 8 /* PARENT */], 'injectorIndex should point to parent injector');
|
---|
126 | }
|
---|
127 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29yZS9zcmMvcmVuZGVyMy9hc3NlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGFBQWEsRUFBRSxXQUFXLEVBQUUsWUFBWSxFQUFFLFVBQVUsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBRXBGLE9BQU8sRUFBQyxlQUFlLEVBQUUsY0FBYyxFQUFDLE1BQU0sY0FBYyxDQUFDO0FBTTdELE9BQU8sRUFBQyxZQUFZLEVBQUUsT0FBTyxFQUFDLE1BQU0sMEJBQTBCLENBQUM7QUFDL0QsT0FBTyxFQUFDLDBCQUEwQixFQUFFLGFBQWEsRUFBUyxNQUFNLEVBQUUsS0FBSyxFQUFRLE1BQU0sbUJBQW1CLENBQUM7QUFFekcsNkVBQTZFO0FBQzdFLHFFQUFxRTtBQUdyRSxNQUFNLFVBQVUsbUJBQW1CLENBQUMsS0FBWSxFQUFFLEtBQVk7SUFDNUQsbUJBQW1CLENBQUMsS0FBSyxFQUFFLEtBQUssQ0FBQyxLQ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