From 8e55a112831dd255265f7cf0320d7fb82d36d7bb Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 11 Feb 2020 10:45:58 +0100 Subject: [PATCH] refactor(core): move schematic base classes logic into shared utils (#35339) Moves the `findBaseClassDeclarations` method into the shared schematic utilities. This method will be useful for future migrations, and for planned changes to the `undecorated-classes-with-decorated-fields` migration. PR Close #35339 --- .../migrations/undecorated-classes-with-di/transform.ts | 2 +- .../typescript}/find_base_classes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/core/schematics/{migrations/undecorated-classes-with-di => utils/typescript}/find_base_classes.ts (92%) diff --git a/packages/core/schematics/migrations/undecorated-classes-with-di/transform.ts b/packages/core/schematics/migrations/undecorated-classes-with-di/transform.ts index 32baa7d1b9..ac3d92e16d 100644 --- a/packages/core/schematics/migrations/undecorated-classes-with-di/transform.ts +++ b/packages/core/schematics/migrations/undecorated-classes-with-di/transform.ts @@ -13,11 +13,11 @@ import * as ts from 'typescript'; import {getAngularDecorators} from '../../utils/ng_decorators'; import {hasExplicitConstructor} from '../../utils/typescript/class_declaration'; +import {findBaseClassDeclarations} from '../../utils/typescript/find_base_classes'; import {getImportOfIdentifier} from '../../utils/typescript/imports'; import {UnexpectedMetadataValueError, convertDirectiveMetadataToExpression} from './decorator_rewrite/convert_directive_metadata'; import {DecoratorRewriter} from './decorator_rewrite/decorator_rewriter'; -import {findBaseClassDeclarations} from './find_base_classes'; import {ImportManager} from './import_manager'; import {hasDirectiveDecorator, hasInjectableDecorator} from './ng_declaration_collector'; import {UpdateRecorder} from './update_recorder'; diff --git a/packages/core/schematics/migrations/undecorated-classes-with-di/find_base_classes.ts b/packages/core/schematics/utils/typescript/find_base_classes.ts similarity index 92% rename from packages/core/schematics/migrations/undecorated-classes-with-di/find_base_classes.ts rename to packages/core/schematics/utils/typescript/find_base_classes.ts index 01467b745d..ae075bce15 100644 --- a/packages/core/schematics/migrations/undecorated-classes-with-di/find_base_classes.ts +++ b/packages/core/schematics/utils/typescript/find_base_classes.ts @@ -7,7 +7,7 @@ */ import * as ts from 'typescript'; -import {getBaseTypeIdentifiers} from '../../utils/typescript/class_declaration'; +import {getBaseTypeIdentifiers} from './class_declaration'; /** Gets all base class declarations of the specified class declaration. */ export function findBaseClassDeclarations(node: ts.ClassDeclaration, typeChecker: ts.TypeChecker) {