refactor(ivy): use ClassDeclaration in more ReflectionHost methods (#29209)

PR Close #29209
This commit is contained in:
George Kalpakas
2019-03-20 12:10:58 +02:00
committed by Miško Hevery
parent bb6a3632f6
commit 2790352d04
22 changed files with 291 additions and 261 deletions

View File

@ -67,12 +67,11 @@ export class NgTscPlugin implements TscPlugin {
const afterDeclarations: Array<ts.TransformerFactory<ts.SourceFile|ts.Bundle>> =
[(context: ts.TransformationContext) => (sf: ts.SourceFile | ts.Bundle) => {
const visitor = (node: ts.Node): ts.Node => {
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
const clz = node as ts.ClassDeclaration;
if (ts.isClassDeclaration(node)) {
// For demo purposes, transform the class name in the .d.ts output
return ts.updateClassDeclaration(
clz, clz.decorators, node.modifiers, ts.createIdentifier('NEWNAME'),
clz.typeParameters, clz.heritageClauses, clz.members);
node, node.decorators, node.modifiers, ts.createIdentifier('NEWNAME'),
node.typeParameters, node.heritageClauses, node.members);
}
return ts.visitEachChild(node, visitor, context);
};