(dir: TcbDirectiveMetadata)
| 265 | } |
| 266 | |
| 267 | typeCtorFor(dir: TcbDirectiveMetadata): TcbExpr { |
| 268 | const existing = this.typeCtors.get(dir.ref.key); |
| 269 | if (existing !== undefined) { |
| 270 | return new TcbExpr(existing); |
| 271 | } |
| 272 | |
| 273 | if (dir.requiresInlineTypeCtor) { |
| 274 | // The type constructor is declared inline in the directive class. |
| 275 | const expr = `${this.referenceTcbValue(dir.ref).print()}.ngTypeCtor`; |
| 276 | this.typeCtors.set(dir.ref.key, expr); |
| 277 | return new TcbExpr(expr); |
| 278 | } |
| 279 | |
| 280 | const fnName = `_ctor${this.nextTypeCtorId++}`; |
| 281 | const meta: TypeCtorMetadata = { |
| 282 | fnName, |
| 283 | body: true, |
| 284 | fields: {inputs: dir.inputs}, |
| 285 | coercedInputFields: dir.coercedInputFields, |
| 286 | }; |
| 287 | this.typeCtorStatements.push( |
| 288 | generateTypeCtorDeclaration( |
| 289 | this, |
| 290 | meta, |
| 291 | this.referenceTcbValue(dir.ref), |
| 292 | dir.typeParameters ?? undefined, |
| 293 | ), |
| 294 | ); |
| 295 | this.typeCtors.set(dir.ref.key, fnName); |
| 296 | return new TcbExpr(fnName); |
| 297 | } |
| 298 | |
| 299 | pipeInst(pipe: TcbPipeMetadata): TcbExpr { |
| 300 | const existing = this.pipeInsts.get(pipe.ref.key); |
nothing calls this directly
no test coverage detected