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

Function makeConditionalFactory

packages/compiler/src/render3/r3_factory.ts:147–157  ·  view source on GitHub ↗
(nonCtorExpr: o.Expression)

Source from the content-addressed store, hash-verified

145 let retExpr: o.Expression | null = null;
146
147 function makeConditionalFactory(nonCtorExpr: o.Expression): o.ReadVarExpr {
148 const r = o.variable('__ngConditionalFactory__');
149 body.push(new o.DeclareVarStmt(r.name, o.NULL_EXPR, o.DYNAMIC_TYPE));
150 const ctorStmt =
151 ctorExpr !== null
152 ? r.set(ctorExpr).toStmt(factoryComments)
153 : o.importExpr(R3.invalidFactory).callFn([]).toStmt();
154 // Always add a `ts-ignore` on the alternate factory.
155 body.push(o.ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt([tsIgnoreComment()])]));
156 return r;
157 }
158
159 if (isDelegatedFactoryMetadata(meta)) {
160 // This type is created with a delegated factory. If a type parameter is not specified, call

Callers 1

compileFactoryFunctionFunction · 0.85

Calls 3

tsIgnoreCommentFunction · 0.90
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…