createPipeInstance method
Implementation
void createPipeInstance(String name, CompilePipeMetadata pipeMeta) {
var usesInjectorGet = false;
final deps = pipeMeta.type!.diDeps.map((diDep) {
if (diDep.token!
.equalsTo(identifierToken(Identifiers.ChangeDetectorRef))) {
return o.THIS_EXPR;
}
usesInjectorGet = true;
return injectFromViewParentInjector(this, diDep.token!, diDep.isOptional);
}).toList();
final pipeInstance = storage.allocate(
name,
outputType: o.importType(pipeMeta.type),
modifiers: [
o.StmtModifier.Private,
o.StmtModifier.Late,
o.StmtModifier.Final,
],
);
final typeExpression = o.importExpr(pipeMeta.type!);
if (usesInjectorGet) {
_createMethod.addStmt(debugInjectorEnter(typeExpression));
}
_createMethod.addStmt(storage
.buildWriteExpr(
pipeInstance,
typeExpression.instantiate(deps),
)
.toStmt());
if (usesInjectorGet) {
_createMethod.addStmt(debugInjectorLeave(typeExpression));
}
}