MCPcopy Index your code
hub / github.com/angular/angular / extractQueriesMetadata

Function extractQueriesMetadata

packages/core/src/render3/jit/directive.ts:444–478  ·  view source on GitHub ↗
(
  type: Type<any>,
  propMetadata: {[key: string]: any[]},
  isQueryAnn: (ann: any) => ann is Query,
)

Source from the content-addressed store, hash-verified

442 };
443}
444function extractQueriesMetadata(
445 type: Type<any>,
446 propMetadata: {[key: string]: any[]},
447 isQueryAnn: (ann: any) => ann is Query,
448): R3QueryMetadataFacade[] {
449 const signalQueriesMeta: R3QueryMetadataFacade[] = [];
450 const decoratorQueriesMeta: R3QueryMetadataFacade[] = [];
451 for (const field in propMetadata) {
452 if (propMetadata.hasOwnProperty(field)) {
453 const annotations = propMetadata[field];
454 annotations.forEach((ann) => {
455 if (isQueryAnn(ann)) {
456 if (!ann.selector) {
457 throw new Error(
458 `Can't construct a query for the property "${field}" of ` +
459 `"${stringifyForError(type)}" since the query selector wasn't defined.`,
460 );
461 }
462 if (annotations.some(isInputAnnotation)) {
463 throw new Error(`Cannot combine @Input decorators with query decorators`);
464 }
465 const queryMeta = convertToR3QueryMetadata(field, ann);
466 if (queryMeta.isSignal) {
467 signalQueriesMeta.push(queryMeta);
468 } else {
469 decoratorQueriesMeta.push(queryMeta);
470 }
471 }
472 });
473 }
474 }
475
476 // We match the behavior of AOT here by having signal queries first, then the decorator queries.
477 return [...signalQueriesMeta, ...decoratorQueriesMeta];
478}
479
480function extractExportAs(exportAs: string | undefined): string[] | null {
481 return exportAs === undefined ? null : splitByComma(exportAs);

Callers 1

directiveMetadataFunction · 0.85

Calls 5

stringifyForErrorFunction · 0.90
someMethod · 0.80
convertToR3QueryMetadataFunction · 0.70
forEachMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…