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

Function compileDeclarationList

packages/compiler/src/render3/view/compiler.ts:351–369  ·  view source on GitHub ↗

* Compiles the array literal of declarations into an expression according to the provided emit * mode.

(
  list: o.LiteralArrayExpr,
  mode: DeclarationListEmitMode,
)

Source from the content-addressed store, hash-verified

349 * mode.
350 */
351function compileDeclarationList(
352 list: o.LiteralArrayExpr,
353 mode: DeclarationListEmitMode,
354): o.Expression {
355 switch (mode) {
356 case DeclarationListEmitMode.Direct:
357 // directives: [MyDir],
358 return list;
359 case DeclarationListEmitMode.Closure:
360 // directives: function () { return [MyDir]; }
361 return o.arrowFn([], list);
362 case DeclarationListEmitMode.ClosureResolved:
363 // directives: function () { return [MyDir].map(ng.resolveForwardRef); }
364 const resolvedList = list.prop('map').callFn([o.importExpr(R3.resolveForwardRef)]);
365 return o.arrowFn([], resolvedList);
366 case DeclarationListEmitMode.RuntimeResolved:
367 throw new Error(`Unsupported with an array of pre-resolved dependencies`);
368 }
369}
370
371function stringAsType(str: string): o.Type {
372 return o.expressionType(o.literal(str));

Callers 1

Calls 1

propMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…