bindPipeDestroyLifecycleCallbacks function

void bindPipeDestroyLifecycleCallbacks(
  1. CompilePipeMetadata pipeMeta,
  2. Expression pipeInstance,
  3. CompileView view
)

Call ngOnDestroy for each pipe that implements OnDestroy.

Implementation

void bindPipeDestroyLifecycleCallbacks(
  CompilePipeMetadata pipeMeta,
  o.Expression pipeInstance,
  CompileView view,
) {
  if (pipeMeta.lifecycleHooks.contains(LifecycleHooks.onDestroy)) {
    view.destroyMethod.addStmt(pipeInstance.callMethod(
      Lifecycles.onDestroy,
      [],
    ).toStmt());
  }
}