MCPcopy Create free account
hub / github.com/angular/angular / generateIndexerAnalysis

Function generateIndexerAnalysis

packages/compiler/src/indexer/transform.ts:19–52  ·  view source on GitHub ↗
(
  context: IndexingContext<T>,
  adapter: NodeAdapter<T>,
)

Source from the content-addressed store, hash-verified

17 * The context must be populated before `generateIndexerAnalysis` is called.
18 */
19export function generateIndexerAnalysis<T>(
20 context: IndexingContext<T>,
21 adapter: NodeAdapter<T>,
22): Map<T, IndexedComponent<T>> {
23 const analysis = new Map<T, IndexedComponent<T>>();
24
25 context.components.forEach(({declaration, selector, boundTemplate, templateMeta}) => {
26 const name = adapter.getName(declaration);
27 const fileName = adapter.getFileName(declaration);
28
29 // Get source files for the component and the template. If the template is inline, its source
30 // file is the component's.
31 let templateFileUrl: string;
32 if (templateMeta.isInline) {
33 templateFileUrl = fileName;
34 } else {
35 templateFileUrl = templateMeta.file.url;
36 }
37
38 const {identifiers, errors} = getIndexerTemplateIdentifiers<T>(boundTemplate);
39 analysis.set(declaration, {
40 name,
41 selector,
42 fileUrl: fileName,
43 template: {
44 identifiers,
45 fileUrl: templateFileUrl,
46 },
47 errors,
48 });
49 });
50
51 return analysis;
52}

Callers 2

getIndexedComponentsMethod · 0.90
transform_spec.tsFile · 0.90

Calls 5

getNameMethod · 0.65
getFileNameMethod · 0.65
setMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected