feat(ivy): dummy handler for @Pipe to cause decorator removal (#24677)

Currently ngtsc does not compile @Pipe. This has a side effect
of not removing the @Pipe decorator.

This adds a dummy DecoratorHandler that compiles @Pipe into an
empty ngPipeDef. Eventually this will be replaced with a full
implementation, but for now this solution allows compield code
to be tree-shaken properly.

PR Close #24677
This commit is contained in:
Alex Rickabaugh
2018-06-20 15:59:15 -07:00
committed by Miško Hevery
parent 2ecaa40e64
commit ef1c6d8c26
3 changed files with 42 additions and 1 deletions

View File

@ -12,7 +12,7 @@ import * as ts from 'typescript';
import * as api from '../transformers/api';
import {ComponentDecoratorHandler, DirectiveDecoratorHandler, InjectableDecoratorHandler, NgModuleDecoratorHandler, SelectorScopeRegistry} from './annotations';
import {ComponentDecoratorHandler, DirectiveDecoratorHandler, InjectableDecoratorHandler, NgModuleDecoratorHandler, PipeDecoratorHandler, SelectorScopeRegistry} from './annotations';
import {CompilerHost} from './compiler_host';
import {TypeScriptReflectionHost} from './metadata';
import {IvyCompilation, ivyTransformFactory} from './transform';
@ -101,6 +101,7 @@ export class NgtscProgram implements api.Program {
new DirectiveDecoratorHandler(checker, reflector, scopeRegistry, isCore),
new InjectableDecoratorHandler(reflector, isCore),
new NgModuleDecoratorHandler(checker, reflector, scopeRegistry, isCore),
new PipeDecoratorHandler(reflector, isCore),
];
const coreImportsFrom = isCore && getR3SymbolsFile(this.tsProgram) || null;