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

Function identifierName

packages/compiler/src/parse_util.ts:209–233  ·  view source on GitHub ↗
(
  compileIdentifier: CompileIdentifierMetadata | null | undefined,
)

Source from the content-addressed store, hash-verified

207let _anonymousTypeIndex = 0;
208
209export function identifierName(
210 compileIdentifier: CompileIdentifierMetadata | null | undefined,
211): string | null {
212 if (!compileIdentifier || !compileIdentifier.reference) {
213 return null;
214 }
215 const ref = compileIdentifier.reference;
216 if (ref['__anonymousType']) {
217 return ref['__anonymousType'];
218 }
219 if (ref['__forward_ref__']) {
220 // We do not want to try to stringify a `forwardRef()` function because that would cause the
221 // inner function to be evaluated too early, defeating the whole point of the `forwardRef`.
222 return '__forward_ref__';
223 }
224 let identifier = stringify(ref);
225 if (identifier.indexOf('(') >= 0) {
226 // case: anonymous functions!
227 identifier = `anonymous_${_anonymousTypeIndex++}`;
228 ref['__anonymousType'] = identifier;
229 } else {
230 identifier = sanitizeIdentifier(identifier);
231 }
232 return identifier;
233}
234
235export interface CompileIdentifierMetadata {
236 reference: any;

Callers 1

Calls 3

stringifyFunction · 0.90
sanitizeIdentifierFunction · 0.85
indexOfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…