feat(core): support 'read' option for ngIvy queries (#20855)
PR Close #20855
This commit is contained in:

committed by
Igor Minar

parent
5df343169e
commit
4f05d022c1
@ -14,6 +14,17 @@ export function assertNodeType(node: LNode, type: LNodeFlags) {
|
||||
assertEqual(node.flags & LNodeFlags.TYPE_MASK, type, 'Node.type', typeSerializer);
|
||||
}
|
||||
|
||||
export function assertNodeOfPossibleTypes(node: LNode, ...types: LNodeFlags[]) {
|
||||
assertNotEqual(node, null, 'node');
|
||||
const nodeType = (node.flags & LNodeFlags.TYPE_MASK);
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
if (nodeType === types[i]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
`Expected node of possible types: ${types.map(typeSerializer).join(', ')} but got ${typeSerializer(nodeType)}`);
|
||||
}
|
||||
|
||||
function typeSerializer(type: LNodeFlags): string {
|
||||
if (type == LNodeFlags.Projection) return 'Projection';
|
||||
|
Reference in New Issue
Block a user