From ccbb913f4be22ddd3c4391b17cd21b87b6a1ca94 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 7 Jun 2021 17:25:45 +0200 Subject: [PATCH] refactor(compiler-cli): ensure compatibility with noImplicitOverride (#42512) Adds the `override` keyword to the `compiler-cli` sources to ensure compatibility with `noImplicitOverride`. PR Close #42512 --- .../emit_scopes/iife_emit_scope.ts | 4 +-- .../src/dependencies/dts_dependency_host.ts | 2 +- .../targeted_entry_point_finder.ts | 2 +- .../tasks/queues/parallel_task_queue.ts | 4 +-- .../ngcc/src/host/commonjs_host.ts | 10 +++---- .../ngcc/src/host/esm2015_host.ts | 26 +++++++++---------- .../compiler-cli/ngcc/src/host/esm5_host.ts | 22 +++++++++------- .../compiler-cli/ngcc/src/host/umd_host.ts | 20 +++++++------- .../ngcc/src/packages/entry_point_manifest.ts | 3 ++- .../ngcc/src/packages/ngcc_compiler_host.ts | 6 +++-- .../rendering/commonjs_rendering_formatter.ts | 8 +++--- .../src/rendering/esm5_rendering_formatter.ts | 6 +++-- .../src/rendering/umd_rendering_formatter.ts | 8 +++--- .../writing/new_entry_point_file_writer.ts | 4 +-- .../test/analysis/ngcc_trait_compiler_spec.ts | 10 ++++--- .../ngcc/test/host/esm2015_host_spec.ts | 2 +- .../lockfile_with_child_process/index_spec.ts | 8 +++--- .../src/ngtsc/annotations/src/component.ts | 5 ++-- .../src/ngtsc/annotations/src/ng_module.ts | 2 +- .../ngtsc/annotations/test/directive_spec.ts | 2 +- .../testing/src/mock_file_system_native.ts | 4 +-- .../src/ngtsc/imports/test/emitter_spec.ts | 2 +- .../src/ngtsc/indexer/src/template.ts | 22 ++++++++-------- .../partial_evaluator/test/evaluator_spec.ts | 6 ++--- .../src/ngtsc/testing/src/compiler_host.ts | 3 ++- .../ngtsc/typecheck/src/template_semantics.ts | 2 +- .../ngtsc/typecheck/src/type_check_block.ts | 10 +++---- .../ngtsc/typecheck/src/type_check_file.ts | 2 +- .../src/ngtsc/util/src/visitor.ts | 6 ++--- .../test/metadata/typescript.mocks.ts | 12 +++------ packages/compiler-cli/test/ngtsc/env.ts | 4 +-- 31 files changed, 117 insertions(+), 110 deletions(-) diff --git a/packages/compiler-cli/linker/src/file_linker/emit_scopes/iife_emit_scope.ts b/packages/compiler-cli/linker/src/file_linker/emit_scopes/iife_emit_scope.ts index d98484453c..0cca62a1f2 100644 --- a/packages/compiler-cli/linker/src/file_linker/emit_scopes/iife_emit_scope.ts +++ b/packages/compiler-cli/linker/src/file_linker/emit_scopes/iife_emit_scope.ts @@ -30,7 +30,7 @@ export class IifeEmitScope extends EmitScope extends EmitScope, missing: Set, deepImports: Set, alreadySeen: Set): boolean { return super.processImport(importPath, file, dependencies, missing, deepImports, alreadySeen) || diff --git a/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts b/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts index 9b729e2183..1c1e3099bc 100644 --- a/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts +++ b/packages/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.ts @@ -35,7 +35,7 @@ export class TargetedEntryPointFinder extends TracingEntryPointFinder { * Search for Angular entry-points that can be reached from the entry-point specified by the given * `targetPath`. */ - findEntryPoints(): SortedEntryPointsInfo { + override findEntryPoints(): SortedEntryPointsInfo { const entryPoints = super.findEntryPoints(); const invalidTarget = diff --git a/packages/compiler-cli/ngcc/src/execution/tasks/queues/parallel_task_queue.ts b/packages/compiler-cli/ngcc/src/execution/tasks/queues/parallel_task_queue.ts index 5a0679b465..f747d33017 100644 --- a/packages/compiler-cli/ngcc/src/execution/tasks/queues/parallel_task_queue.ts +++ b/packages/compiler-cli/ngcc/src/execution/tasks/queues/parallel_task_queue.ts @@ -41,7 +41,7 @@ export class ParallelTaskQueue extends BaseTaskQueue { return nextTask; } - markAsCompleted(task: Task): void { + override markAsCompleted(task: Task): void { super.markAsCompleted(task); if (!this.dependencies.has(task)) { @@ -62,7 +62,7 @@ export class ParallelTaskQueue extends BaseTaskQueue { } } - toString(): string { + override toString(): string { return `${super.toString()}\n` + ` Blocked tasks (${this.blockedTasks.size}): ${this.stringifyBlockedTasks(' ')}`; } diff --git a/packages/compiler-cli/ngcc/src/host/commonjs_host.ts b/packages/compiler-cli/ngcc/src/host/commonjs_host.ts index f467d5beee..3cbd94bfe9 100644 --- a/packages/compiler-cli/ngcc/src/host/commonjs_host.ts +++ b/packages/compiler-cli/ngcc/src/host/commonjs_host.ts @@ -35,7 +35,7 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost { this.compilerHost = src.host; } - getImportOfIdentifier(id: ts.Identifier): Import|null { + override getImportOfIdentifier(id: ts.Identifier): Import|null { const requireCall = this.findCommonJsImport(id); if (requireCall === null) { return null; @@ -43,11 +43,11 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost { return {from: requireCall.arguments[0].text, name: id.text}; } - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { return this.getCommonJsModuleDeclaration(id) || super.getDeclarationOfIdentifier(id); } - getExportsOfModule(module: ts.Node): Map|null { + override getExportsOfModule(module: ts.Node): Map|null { return super.getExportsOfModule(module) || this.commonJsExports.get(module.getSourceFile()); } @@ -64,7 +64,7 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost { * in. * @returns an array of nodes of calls to the helper with the given name. */ - protected getHelperCallsForClass(classSymbol: NgccClassSymbol, helperNames: string[]): + protected override getHelperCallsForClass(classSymbol: NgccClassSymbol, helperNames: string[]): ts.CallExpression[] { const esm5HelperCalls = super.getHelperCallsForClass(classSymbol, helperNames); if (esm5HelperCalls.length > 0) { @@ -221,7 +221,7 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost { * If this is an IFE then try to grab the outer and inner classes otherwise fallback on the super * class. */ - protected getDeclarationOfExpression(expression: ts.Expression): Declaration|null { + protected override getDeclarationOfExpression(expression: ts.Expression): Declaration|null { const inner = getInnerClassDeclaration(expression); if (inner !== null) { const outer = getOuterNodeFromInnerDeclaration(inner); diff --git a/packages/compiler-cli/ngcc/src/host/esm2015_host.ts b/packages/compiler-cli/ngcc/src/host/esm2015_host.ts index dde6c3e66d..f75d577d90 100644 --- a/packages/compiler-cli/ngcc/src/host/esm2015_host.ts +++ b/packages/compiler-cli/ngcc/src/host/esm2015_host.ts @@ -151,7 +151,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * `null` if either no decorators were present or if the declaration is not of a decoratable * type. */ - getDecoratorsOfDeclaration(declaration: DeclarationNode): Decorator[]|null { + override getDecoratorsOfDeclaration(declaration: DeclarationNode): Decorator[]|null { const symbol = this.getClassSymbol(declaration); if (!symbol) { return null; @@ -169,7 +169,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * * @throws if `declaration` does not resolve to a class declaration. */ - getMembersOfClass(clazz: ClassDeclaration): ClassMember[] { + override getMembersOfClass(clazz: ClassDeclaration): ClassMember[] { const classSymbol = this.getClassSymbol(clazz); if (!classSymbol) { throw new Error(`Attempted to get members of a non-class: "${clazz.getText()}"`); @@ -192,7 +192,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * * @throws if `declaration` does not resolve to a class declaration. */ - getConstructorParameters(clazz: ClassDeclaration): CtorParameter[]|null { + override getConstructorParameters(clazz: ClassDeclaration): CtorParameter[]|null { const classSymbol = this.getClassSymbol(clazz); if (!classSymbol) { throw new Error( @@ -205,7 +205,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N return null; } - getBaseClassExpression(clazz: ClassDeclaration): ts.Expression|null { + override getBaseClassExpression(clazz: ClassDeclaration): ts.Expression|null { // First try getting the base class from an ES2015 class declaration const superBaseClassIdentifier = super.getBaseClassExpression(clazz); if (superBaseClassIdentifier) { @@ -221,7 +221,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N return super.getBaseClassExpression(classSymbol.implementation.valueDeclaration); } - getInternalNameOfClass(clazz: ClassDeclaration): ts.Identifier { + override getInternalNameOfClass(clazz: ClassDeclaration): ts.Identifier { const classSymbol = this.getClassSymbol(clazz); if (classSymbol === undefined) { throw new Error(`getInternalNameOfClass() called on a non-class: expected ${ @@ -231,7 +231,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N classSymbol, classSymbol.implementation.valueDeclaration); } - getAdjacentNameOfClass(clazz: ClassDeclaration): ts.Identifier { + override getAdjacentNameOfClass(clazz: ClassDeclaration): ts.Identifier { const classSymbol = this.getClassSymbol(clazz); if (classSymbol === undefined) { throw new Error(`getAdjacentNameOfClass() called on a non-class: expected ${ @@ -259,7 +259,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N /** * Check whether the given node actually represents a class. */ - isClass(node: ts.Node): node is ClassDeclaration { + override isClass(node: ts.Node): node is ClassDeclaration { return super.isClass(node) || this.getClassSymbol(node) !== undefined; } @@ -279,7 +279,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * @returns metadata about the `Declaration` if the original declaration is found, or `null` * otherwise. */ - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { const superDeclaration = super.getDeclarationOfIdentifier(id); // If no declaration was found, return. @@ -355,7 +355,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N []; } - getVariableValue(declaration: ts.VariableDeclaration): ts.Expression|null { + override getVariableValue(declaration: ts.VariableDeclaration): ts.Expression|null { const value = super.getVariableValue(declaration); if (value) { return value; @@ -434,7 +434,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * @returns the number of type parameters of the class, if known, or `null` if the declaration * is not a class or has an unknown number of type parameters. */ - getGenericArityOfClass(clazz: ClassDeclaration): number|null { + override getGenericArityOfClass(clazz: ClassDeclaration): number|null { const dtsDeclaration = this.getDtsDeclaration(clazz); if (dtsDeclaration && ts.isClassDeclaration(dtsDeclaration)) { return dtsDeclaration.typeParameters ? dtsDeclaration.typeParameters.length : 0; @@ -454,7 +454,7 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * Note that the `ts.ClassDeclaration` returned from this function may not be from the same * `ts.Program` as the input declaration. */ - getDtsDeclaration(declaration: DeclarationNode): ts.Declaration|null { + override getDtsDeclaration(declaration: DeclarationNode): ts.Declaration|null { if (this.dts === null) { return null; } @@ -769,8 +769,8 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N * Resolve a `ts.Symbol` to its declaration and detect whether it corresponds with a known * declaration. */ - protected getDeclarationOfSymbol(symbol: ts.Symbol, originalId: ts.Identifier|null): Declaration - |null { + protected override getDeclarationOfSymbol(symbol: ts.Symbol, originalId: ts.Identifier|null): + Declaration|null { const declaration = super.getDeclarationOfSymbol(symbol, originalId); if (declaration === null) { return null; diff --git a/packages/compiler-cli/ngcc/src/host/esm5_host.ts b/packages/compiler-cli/ngcc/src/host/esm5_host.ts index 1fe47c4203..0bd4fc5c81 100644 --- a/packages/compiler-cli/ngcc/src/host/esm5_host.ts +++ b/packages/compiler-cli/ngcc/src/host/esm5_host.ts @@ -34,7 +34,7 @@ import {NgccClassSymbol} from './ngcc_host'; * */ export class Esm5ReflectionHost extends Esm2015ReflectionHost { - getBaseClassExpression(clazz: ClassDeclaration): ts.Expression|null { + override getBaseClassExpression(clazz: ClassDeclaration): ts.Expression|null { const superBaseClassExpression = super.getBaseClassExpression(clazz); if (superBaseClassExpression !== null) { return superBaseClassExpression; @@ -71,7 +71,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @returns metadata about the `Declaration` if the original declaration is found, or `null` * otherwise. */ - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { const declaration = super.getDeclarationOfIdentifier(id); if (declaration === null) { @@ -127,7 +127,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @param node the function declaration to parse. * @returns an object containing the node, statements and parameters of the function. */ - getDefinitionOfFunction(node: ts.Node): FunctionDefinition|null { + override getDefinitionOfFunction(node: ts.Node): FunctionDefinition|null { const definition = super.getDefinitionOfFunction(node); if (definition === null) { return null; @@ -155,7 +155,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @param decl The `Declaration` to check. * @return The passed in `Declaration` (potentially enhanced with a `KnownDeclaration`). */ - detectKnownDeclaration(decl: T): T { + override detectKnownDeclaration(decl: T): T { decl = super.detectKnownDeclaration(decl); // Also check for TS helpers @@ -180,7 +180,8 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @param declaration the declaration whose symbol we are finding. * @returns the symbol for the node or `undefined` if it is not a "class" or has no symbol. */ - protected getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol|undefined { + protected override getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol + |undefined { const classSymbol = super.getClassSymbolFromInnerDeclaration(declaration); if (classSymbol !== undefined) { return classSymbol; @@ -210,7 +211,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @returns an array of `ts.ParameterDeclaration` objects representing each of the parameters in * the class's constructor or `null` if there is no constructor. */ - protected getConstructorParameterDeclarations(classSymbol: NgccClassSymbol): + protected override getConstructorParameterDeclarations(classSymbol: NgccClassSymbol): ts.ParameterDeclaration[]|null { const constructor = classSymbol.implementation.valueDeclaration; if (!ts.isFunctionDeclaration(constructor)) return null; @@ -248,7 +249,8 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @param paramDecoratorsProperty the property that holds the parameter info we want to get. * @returns an array of objects containing the type and decorators for each parameter. */ - protected getParamInfoFromStaticProperty(paramDecoratorsProperty: ts.Symbol): ParamInfo[]|null { + protected override getParamInfoFromStaticProperty(paramDecoratorsProperty: ts.Symbol): + ParamInfo[]|null { const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty); // The decorators array may be wrapped in a function. If so unwrap it. const returnStatement = getReturnStatement(paramDecorators); @@ -284,8 +286,8 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * @param isStatic true if this member is static, false if it is an instance property. * @returns the reflected member information, or null if the symbol is not a member. */ - protected reflectMembers(symbol: ts.Symbol, decorators?: Decorator[], isStatic?: boolean): - ClassMember[]|null { + protected override reflectMembers( + symbol: ts.Symbol, decorators?: Decorator[], isStatic?: boolean): ClassMember[]|null { const node = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0]; const propertyDefinition = node && getPropertyDefinition(node); if (propertyDefinition) { @@ -348,7 +350,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * to reference the inner identifier inside the IIFE. * @returns an array of statements that may contain helper calls. */ - protected getStatementsForClass(classSymbol: NgccClassSymbol): ts.Statement[] { + protected override getStatementsForClass(classSymbol: NgccClassSymbol): ts.Statement[] { const classDeclarationParent = classSymbol.implementation.valueDeclaration.parent; return ts.isBlock(classDeclarationParent) ? Array.from(classDeclarationParent.statements) : []; } diff --git a/packages/compiler-cli/ngcc/src/host/umd_host.ts b/packages/compiler-cli/ngcc/src/host/umd_host.ts index 974ccc8e0d..f167213ff8 100644 --- a/packages/compiler-cli/ngcc/src/host/umd_host.ts +++ b/packages/compiler-cli/ngcc/src/host/umd_host.ts @@ -36,7 +36,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { this.compilerHost = src.host; } - getImportOfIdentifier(id: ts.Identifier): Import|null { + override getImportOfIdentifier(id: ts.Identifier): Import|null { // Is `id` a namespaced property access, e.g. `Directive` in `core.Directive`? // If so capture the symbol of the namespace, e.g. `core`. const nsIdentifier = findNamespaceOfIdentifier(id); @@ -45,7 +45,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { return from !== null ? {from, name: id.text} : null; } - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { // First we try one of the following: // 1. The `exports` identifier - referring to the current file/module. // 2. An identifier (e.g. `foo`) that refers to an imported UMD module. @@ -83,7 +83,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { }; } - getExportsOfModule(module: ts.Node): Map|null { + override getExportsOfModule(module: ts.Node): Map|null { return super.getExportsOfModule(module) || this.umdExports.get(module.getSourceFile()); } @@ -107,12 +107,13 @@ export class UmdReflectionHost extends Esm5ReflectionHost { * @param sourceFile The module whose statements we want. * @returns An array of top level statements for the given module. */ - protected getModuleStatements(sourceFile: ts.SourceFile): ts.Statement[] { + protected override getModuleStatements(sourceFile: ts.SourceFile): ts.Statement[] { const umdModule = this.getUmdModule(sourceFile); return umdModule !== null ? Array.from(umdModule.factoryFn.body.statements) : []; } - protected getClassSymbolFromOuterDeclaration(declaration: ts.Node): NgccClassSymbol|undefined { + protected override getClassSymbolFromOuterDeclaration(declaration: ts.Node): NgccClassSymbol + |undefined { const superSymbol = super.getClassSymbolFromOuterDeclaration(declaration); if (superSymbol) { return superSymbol; @@ -143,7 +144,8 @@ export class UmdReflectionHost extends Esm5ReflectionHost { } - protected getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol|undefined { + protected override getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol + |undefined { const superClassSymbol = super.getClassSymbolFromInnerDeclaration(declaration); if (superClassSymbol !== undefined) { return superClassSymbol; @@ -164,7 +166,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { /** * Extract all "classes" from the `statement` and add them to the `classes` map. */ - protected addClassSymbolsFromStatement( + protected override addClassSymbolsFromStatement( classes: Map, statement: ts.Statement): void { super.addClassSymbolsFromStatement(classes, statement); @@ -184,7 +186,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { * * @param statement The statement that needs to be preprocessed. */ - protected preprocessStatement(statement: ts.Statement): void { + protected override preprocessStatement(statement: ts.Statement): void { super.preprocessStatement(statement); if (!isExportsStatement(statement)) { @@ -474,7 +476,7 @@ export class UmdReflectionHost extends Esm5ReflectionHost { * If this is an IIFE then try to grab the outer and inner classes otherwise fallback on the super * class. */ - protected getDeclarationOfExpression(expression: ts.Expression): Declaration|null { + protected override getDeclarationOfExpression(expression: ts.Expression): Declaration|null { const inner = getInnerClassDeclaration(expression); if (inner !== null) { const outer = getOuterNodeFromInnerDeclaration(inner); diff --git a/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts b/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts index e689c5e756..1bf23464b5 100644 --- a/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts +++ b/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts @@ -175,7 +175,8 @@ export class EntryPointManifest { * is called. */ export class InvalidatingEntryPointManifest extends EntryPointManifest { - readEntryPointsUsingManifest(_basePath: AbsoluteFsPath): EntryPointWithDependencies[]|null { + override readEntryPointsUsingManifest(_basePath: AbsoluteFsPath): + EntryPointWithDependencies[]|null { return null; } } diff --git a/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.ts b/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.ts index c679a12503..70ed061b55 100644 --- a/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.ts +++ b/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.ts @@ -26,7 +26,8 @@ export class NgccSourcesCompilerHost extends NgtscCompilerHost { super(fs, options); } - getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile|undefined { + override getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile + |undefined { return this.cache.getCachedSourceFile(fileName, languageVersion); } @@ -78,7 +79,8 @@ export class NgccDtsCompilerHost extends NgtscCompilerHost { super(fs, options); } - getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile|undefined { + override getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile + |undefined { return this.cache.getCachedSourceFile(fileName, languageVersion); } diff --git a/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.ts b/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.ts index f18a0181dc..98abc8d10f 100644 --- a/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.ts +++ b/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.ts @@ -31,7 +31,7 @@ export class CommonJsRenderingFormatter extends Esm5RenderingFormatter { /** * Add the imports below any in situ imports as `require` calls. */ - addImports(output: MagicString, imports: Import[], file: ts.SourceFile): void { + override addImports(output: MagicString, imports: Import[], file: ts.SourceFile): void { // Avoid unnecessary work if there are no imports to add. if (imports.length === 0) { return; @@ -46,7 +46,7 @@ export class CommonJsRenderingFormatter extends Esm5RenderingFormatter { /** * Add the exports to the bottom of the file. */ - addExports( + override addExports( output: MagicString, entryPointBasePath: string, exports: ExportInfo[], importManager: ImportManager, file: ts.SourceFile): void { exports.forEach(e => { @@ -61,7 +61,7 @@ export class CommonJsRenderingFormatter extends Esm5RenderingFormatter { }); } - addDirectExports( + override addDirectExports( output: MagicString, exports: Reexport[], importManager: ImportManager, file: ts.SourceFile): void { for (const e of exports) { @@ -72,7 +72,7 @@ export class CommonJsRenderingFormatter extends Esm5RenderingFormatter { } } - protected findEndOfImports(sf: ts.SourceFile): number { + protected override findEndOfImports(sf: ts.SourceFile): number { for (const statement of sf.statements) { if (ts.isExpressionStatement(statement) && isRequireCall(statement.expression)) { continue; diff --git a/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.ts b/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.ts index 2f5fdc4b5f..389eae6559 100644 --- a/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.ts +++ b/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.ts @@ -24,7 +24,8 @@ export class Esm5RenderingFormatter extends EsmRenderingFormatter { * Add the definitions, directly before the return statement, inside the IIFE of each decorated * class. */ - addDefinitions(output: MagicString, compiledClass: CompiledClass, definitions: string): void { + override addDefinitions(output: MagicString, compiledClass: CompiledClass, definitions: string): + void { const classSymbol = this.host.getClassSymbol(compiledClass.declaration); if (!classSymbol) { throw new Error( @@ -63,7 +64,8 @@ export class Esm5RenderingFormatter extends EsmRenderingFormatter { * * @return The JavaScript code corresponding to `stmt` (in the appropriate format). */ - printStatement(stmt: Statement, sourceFile: ts.SourceFile, importManager: ImportManager): string { + override printStatement(stmt: Statement, sourceFile: ts.SourceFile, importManager: ImportManager): + string { const node = translateStatement( stmt, importManager, {downlevelTaggedTemplates: true, downlevelVariableDeclarations: true}); const code = this.printer.printNode(ts.EmitHint.Unspecified, node, sourceFile); diff --git a/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.ts b/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.ts index 662c046d07..b1591c37fe 100644 --- a/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.ts +++ b/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.ts @@ -50,7 +50,7 @@ export class UmdRenderingFormatter extends Esm5RenderingFormatter { * * (See that the `z` import is not being used by the factory function.) */ - addImports(output: MagicString, imports: Import[], file: ts.SourceFile): void { + override addImports(output: MagicString, imports: Import[], file: ts.SourceFile): void { if (imports.length === 0) { return; } @@ -73,7 +73,7 @@ export class UmdRenderingFormatter extends Esm5RenderingFormatter { /** * Add the exports to the bottom of the UMD module factory function. */ - addExports( + override addExports( output: MagicString, entryPointBasePath: string, exports: ExportInfo[], importManager: ImportManager, file: ts.SourceFile): void { const umdModule = this.umdHost.getUmdModule(file); @@ -97,7 +97,7 @@ export class UmdRenderingFormatter extends Esm5RenderingFormatter { }); } - addDirectExports( + override addDirectExports( output: MagicString, exports: Reexport[], importManager: ImportManager, file: ts.SourceFile): void { const umdModule = this.umdHost.getUmdModule(file); @@ -120,7 +120,7 @@ export class UmdRenderingFormatter extends Esm5RenderingFormatter { /** * Add the constants to the top of the UMD factory function. */ - addConstants(output: MagicString, constants: string, file: ts.SourceFile): void { + override addConstants(output: MagicString, constants: string, file: ts.SourceFile): void { if (constants === '') { return; } diff --git a/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts b/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts index 114d2f72ea..ea40506334 100644 --- a/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts +++ b/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts @@ -34,7 +34,7 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter { super(fs, logger, errorOnFailedEntryPoint); } - writeBundle( + override writeBundle( bundle: EntryPointBundle, transformedFiles: FileToWrite[], formatProperties: EntryPointJsonProperty[]) { // The new folder is at the root of the overall package @@ -45,7 +45,7 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter { this.updatePackageJson(entryPoint, formatProperties, ngccFolder); } - revertBundle( + override revertBundle( entryPoint: EntryPoint, transformedFilePaths: AbsoluteFsPath[], formatProperties: EntryPointJsonProperty[]): void { // IMPLEMENTATION NOTE: diff --git a/packages/compiler-cli/ngcc/test/analysis/ngcc_trait_compiler_spec.ts b/packages/compiler-cli/ngcc/test/analysis/ngcc_trait_compiler_spec.ts index 2cd0ddd0c6..bfcbdc9440 100644 --- a/packages/compiler-cli/ngcc/test/analysis/ngcc_trait_compiler_spec.ts +++ b/packages/compiler-cli/ngcc/test/analysis/ngcc_trait_compiler_spec.ts @@ -323,7 +323,8 @@ class TestHandler implements DecoratorHandler { } class AlwaysDetectHandler extends TestHandler { - detect(node: ClassDeclaration, decorators: Decorator[]|null): DetectResult|undefined { + override detect(node: ClassDeclaration, decorators: Decorator[]|null): + DetectResult|undefined { super.detect(node, decorators); const decorator = decorators !== null ? decorators[0] : null; return {trigger: node, decorator, metadata: {}}; @@ -331,11 +332,12 @@ class AlwaysDetectHandler extends TestHandler { } class DetectDecoratorHandler extends TestHandler { - constructor(private decorator: string, readonly precedence: HandlerPrecedence) { + constructor(private decorator: string, override readonly precedence: HandlerPrecedence) { super(decorator, []); } - detect(node: ClassDeclaration, decorators: Decorator[]|null): DetectResult|undefined { + override detect(node: ClassDeclaration, decorators: Decorator[]|null): + DetectResult|undefined { super.detect(node, decorators); if (decorators === null) { return undefined; @@ -349,7 +351,7 @@ class DetectDecoratorHandler extends TestHandler { } class DiagnosticProducingHandler extends AlwaysDetectHandler { - analyze(node: ClassDeclaration): AnalysisOutput { + override analyze(node: ClassDeclaration): AnalysisOutput { super.analyze(node); return {diagnostics: [makeDiagnostic(9999, node, 'test diagnostic')]}; } diff --git a/packages/compiler-cli/ngcc/test/host/esm2015_host_spec.ts b/packages/compiler-cli/ngcc/test/host/esm2015_host_spec.ts index 69a8ff4df5..6cbe7ec2c6 100644 --- a/packages/compiler-cli/ngcc/test/host/esm2015_host_spec.ts +++ b/packages/compiler-cli/ngcc/test/host/esm2015_host_spec.ts @@ -2506,7 +2506,7 @@ runInEachFileSystem(() => { const externalLibWithoutTypingsIndex = _('/an_external_lib_without_typings/index.js'); class TestEsm2015ReflectionHost extends Esm2015ReflectionHost { - getExportsOfModule(node: ts.Node) { + override getExportsOfModule(node: ts.Node) { if (ts.isSourceFile(node) && (node.fileName === externalLibWithoutTypingsIndex)) { throw new Error( `'getExportsOfModule()' called on '${externalLibWithoutTypingsIndex}'.`); diff --git a/packages/compiler-cli/ngcc/test/locking/lockfile_with_child_process/index_spec.ts b/packages/compiler-cli/ngcc/test/locking/lockfile_with_child_process/index_spec.ts index 69017747e7..edff4dc0b7 100644 --- a/packages/compiler-cli/ngcc/test/locking/lockfile_with_child_process/index_spec.ts +++ b/packages/compiler-cli/ngcc/test/locking/lockfile_with_child_process/index_spec.ts @@ -28,20 +28,20 @@ runInEachFileSystem(() => { super(fs, new MockLogger()); fs.ensureDir(fs.dirname(this.path)); } - remove() { + override remove() { this.log.push('remove()'); super.remove(); } - write() { + override write() { this.log.push('write()'); super.write(); } - read() { + override read() { const contents = super.read(); this.log.push('read() => ' + contents); return contents; } - createUnlocker(): ChildProcess { + override createUnlocker(): ChildProcess { this.log = this.log || []; this.log.push('createUnlocker()'); const log = this.log; diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts index 3ec40f3265..281c99b117 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts @@ -123,7 +123,8 @@ export class ComponentSymbol extends DirectiveSymbol { usedPipes: SemanticReference[] = []; isRemotelyScoped = false; - isEmitAffected(previousSymbol: SemanticSymbol, publicApiAffected: Set): boolean { + override isEmitAffected(previousSymbol: SemanticSymbol, publicApiAffected: Set): + boolean { if (!(previousSymbol instanceof ComponentSymbol)) { return true; } @@ -146,7 +147,7 @@ export class ComponentSymbol extends DirectiveSymbol { !isArrayEqual(this.usedPipes, previousSymbol.usedPipes, isSymbolUnaffected); } - isTypeCheckBlockAffected( + override isTypeCheckBlockAffected( previousSymbol: SemanticSymbol, typeCheckApiAffected: Set): boolean { if (!(previousSymbol instanceof ComponentSymbol)) { return true; diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts index cb98a2fa78..d581d3df63 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts @@ -67,7 +67,7 @@ export class NgModuleSymbol extends SemanticSymbol { return false; } - isEmitAffected(previousSymbol: SemanticSymbol): boolean { + override isEmitAffected(previousSymbol: SemanticSymbol): boolean { if (!(previousSymbol instanceof NgModuleSymbol)) { return true; } diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts b/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts index bfef378682..e45fade999 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts @@ -153,7 +153,7 @@ runInEachFileSystem(() => { super(checker); } - hasBaseClass(_class: ClassDeclaration): boolean { + override hasBaseClass(_class: ClassDeclaration): boolean { return hasBaseClass; } } diff --git a/packages/compiler-cli/src/ngtsc/file_system/testing/src/mock_file_system_native.ts b/packages/compiler-cli/src/ngtsc/file_system/testing/src/mock_file_system_native.ts index e856448a35..bf3dd40597 100644 --- a/packages/compiler-cli/src/ngtsc/file_system/testing/src/mock_file_system_native.ts +++ b/packages/compiler-cli/src/ngtsc/file_system/testing/src/mock_file_system_native.ts @@ -38,7 +38,7 @@ export class MockFileSystemNative extends MockFileSystem { return NodeJSFileSystem.prototype.basename.call(this, filePath, extension); } - isCaseSensitive() { + override isCaseSensitive() { return NodeJSFileSystem.prototype.isCaseSensitive.call(this); } @@ -46,7 +46,7 @@ export class MockFileSystemNative extends MockFileSystem { return NodeJSFileSystem.prototype.isRooted.call(this, path); } - isRoot(path: AbsoluteFsPath): boolean { + override isRoot(path: AbsoluteFsPath): boolean { return NodeJSFileSystem.prototype.isRoot.call(this, path); } diff --git a/packages/compiler-cli/src/ngtsc/imports/test/emitter_spec.ts b/packages/compiler-cli/src/ngtsc/imports/test/emitter_spec.ts index f38190865f..3b5f968df5 100644 --- a/packages/compiler-cli/src/ngtsc/imports/test/emitter_spec.ts +++ b/packages/compiler-cli/src/ngtsc/imports/test/emitter_spec.ts @@ -175,7 +175,7 @@ runInEachFileSystem(() => { it('should enumerate exports with the ReflectionHost', () => { // Use a modified ReflectionHost that prefixes all export names that it enumerates. class TestHost extends TypeScriptReflectionHost { - getExportsOfModule(node: ts.Node): Map|null { + override getExportsOfModule(node: ts.Node): Map|null { const realExports = super.getExportsOfModule(node); if (realExports === null) { return null; diff --git a/packages/compiler-cli/src/ngtsc/indexer/src/template.ts b/packages/compiler-cli/src/ngtsc/indexer/src/template.ts index e8ec2507ed..b7c3693925 100644 --- a/packages/compiler-cli/src/ngtsc/indexer/src/template.ts +++ b/packages/compiler-cli/src/ngtsc/indexer/src/template.ts @@ -62,21 +62,21 @@ class ExpressionVisitor extends RecursiveAstVisitor { return visitor.identifiers; } - visit(ast: AST) { + override visit(ast: AST) { ast.visit(this); } - visitMethodCall(ast: MethodCall, context: {}) { + override visitMethodCall(ast: MethodCall, context: {}) { this.visitIdentifier(ast, IdentifierKind.Method); super.visitMethodCall(ast, context); } - visitPropertyRead(ast: PropertyRead, context: {}) { + override visitPropertyRead(ast: PropertyRead, context: {}) { this.visitIdentifier(ast, IdentifierKind.Property); super.visitPropertyRead(ast, context); } - visitPropertyWrite(ast: PropertyWrite, context: {}) { + override visitPropertyWrite(ast: PropertyWrite, context: {}) { this.visitIdentifier(ast, IdentifierKind.Property); super.visitPropertyWrite(ast, context); } @@ -165,7 +165,7 @@ class TemplateVisitor extends TmplAstRecursiveVisitor { * * @param element */ - visitElement(element: TmplAstElement) { + override visitElement(element: TmplAstElement) { const elementIdentifier = this.elementOrTemplateToIdentifier(element); this.identifiers.add(elementIdentifier); @@ -176,7 +176,7 @@ class TemplateVisitor extends TmplAstRecursiveVisitor { this.visitAll(element.children); this.visitAll(element.outputs); } - visitTemplate(template: TmplAstTemplate) { + override visitTemplate(template: TmplAstTemplate) { const templateIdentifier = this.elementOrTemplateToIdentifier(template); this.identifiers.add(templateIdentifier); @@ -187,7 +187,7 @@ class TemplateVisitor extends TmplAstRecursiveVisitor { this.visitAll(template.children); this.visitAll(template.references); } - visitBoundAttribute(attribute: TmplAstBoundAttribute) { + override visitBoundAttribute(attribute: TmplAstBoundAttribute) { // If the bound attribute has no value, it cannot have any identifiers in the value expression. if (attribute.valueSpan === undefined) { return; @@ -198,18 +198,18 @@ class TemplateVisitor extends TmplAstRecursiveVisitor { this.boundTemplate, this.targetToIdentifier.bind(this)); identifiers.forEach(id => this.identifiers.add(id)); } - visitBoundEvent(attribute: TmplAstBoundEvent) { + override visitBoundEvent(attribute: TmplAstBoundEvent) { this.visitExpression(attribute.handler); } - visitBoundText(text: TmplAstBoundText) { + override visitBoundText(text: TmplAstBoundText) { this.visitExpression(text.value); } - visitReference(reference: TmplAstReference) { + override visitReference(reference: TmplAstReference) { const referenceIdentifer = this.targetToIdentifier(reference); this.identifiers.add(referenceIdentifer); } - visitVariable(variable: TmplAstVariable) { + override visitVariable(variable: TmplAstVariable) { const variableIdentifier = this.targetToIdentifier(variable); this.identifiers.add(variableIdentifier); diff --git a/packages/compiler-cli/src/ngtsc/partial_evaluator/test/evaluator_spec.ts b/packages/compiler-cli/src/ngtsc/partial_evaluator/test/evaluator_spec.ts index 7582aaebcf..710143d799 100644 --- a/packages/compiler-cli/src/ngtsc/partial_evaluator/test/evaluator_spec.ts +++ b/packages/compiler-cli/src/ngtsc/partial_evaluator/test/evaluator_spec.ts @@ -1036,7 +1036,7 @@ runInEachFileSystem(() => { }); class DownleveledEnumReflectionHost extends TypeScriptReflectionHost { - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { const declaration = super.getDeclarationOfIdentifier(id); if (declaration !== null && isConcreteDeclaration(declaration)) { const enumMembers = [ @@ -1055,7 +1055,7 @@ runInEachFileSystem(() => { * TypeScript host, as only ngcc's ES5 hosts will have special powers to recognize such functions. */ class TsLibAwareReflectionHost extends TypeScriptReflectionHost { - getExportsOfModule(node: ts.Node): Map|null { + override getExportsOfModule(node: ts.Node): Map|null { const map = super.getExportsOfModule(node); if (map !== null) { @@ -1065,7 +1065,7 @@ runInEachFileSystem(() => { return map; } - getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { + override getDeclarationOfIdentifier(id: ts.Identifier): Declaration|null { const superDeclaration = super.getDeclarationOfIdentifier(id); if (superDeclaration === null || superDeclaration.node === null) { diff --git a/packages/compiler-cli/src/ngtsc/testing/src/compiler_host.ts b/packages/compiler-cli/src/ngtsc/testing/src/compiler_host.ts index 83ca99ee1b..1ccb9ed120 100644 --- a/packages/compiler-cli/src/ngtsc/testing/src/compiler_host.ts +++ b/packages/compiler-cli/src/ngtsc/testing/src/compiler_host.ts @@ -15,7 +15,8 @@ import {getCachedSourceFile} from './cached_source_files'; * reuse across tests. */ export class NgtscTestCompilerHost extends NgtscCompilerHost { - getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile|undefined { + override getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile + |undefined { const cachedSf = getCachedSourceFile(fileName, () => this.readFile(fileName)); if (cachedSf !== null) { return cachedSf; diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.ts index d51a075bd0..5e8a7bbb6c 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.ts @@ -22,7 +22,7 @@ export class ExpressionSemanticVisitor extends RecursiveAstVisitor { super(); } - visitPropertyWrite(ast: PropertyWrite, context: any): void { + override visitPropertyWrite(ast: PropertyWrite, context: any): void { super.visitPropertyWrite(ast, context); if (!(ast.receiver instanceof ImplicitReceiver)) { diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts index 47ad813ae3..0dff1183da 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts @@ -471,7 +471,7 @@ abstract class TcbDirectiveTypeOpBase extends TcbOp { /** * A `TcbOp` which constructs an instance of a non-generic directive _without_ setting any of its - * inputs. Inputs are later set in the `TcbDirectiveInputsOp`. Type checking was found to be + * inputs. Inputs are later set in the `TcbDirectiveInputsOp`. Type checking was found to be * faster when done in this way as opposed to `TcbDirectiveCtorOp` which is only necessary when the * directive is generic. * @@ -483,7 +483,7 @@ class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase { * Creates a variable declaration for this op's directive of the argument type. Returns the id of * the newly created variable. */ - execute(): ts.Identifier { + override execute(): ts.Identifier { const dirRef = this.dir.ref as Reference>; if (this.dir.isGeneric) { throw new Error(`Assertion Error: expected ${dirRef.debugName} not to be generic.`); @@ -501,7 +501,7 @@ class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase { * type parameters set to `any`. */ class TcbGenericDirectiveTypeWithAnyParamsOp extends TcbDirectiveTypeOpBase { - execute(): ts.Identifier { + override execute(): ts.Identifier { const dirRef = this.dir.ref as Reference>; if (dirRef.node.typeParameters === undefined) { throw new Error(`Assertion Error: expected typeParameters when creating a declaration for ${ @@ -671,7 +671,7 @@ class TcbDirectiveCtorOp extends TcbOp { return id; } - circularFallback(): TcbOp { + override circularFallback(): TcbOp { return new TcbDirectiveCtorCircularFallbackOp(this.tcb, this.scope, this.node, this.dir); } } @@ -1980,7 +1980,7 @@ function tcbEventHandlerExpression(ast: AST, tcb: Context, scope: Scope): ts.Exp } class TcbEventHandlerTranslator extends TcbExpressionTranslator { - protected resolve(ast: AST): ts.Expression|null { + protected override resolve(ast: AST): ts.Expression|null { // Recognize a property read on the implicit receiver corresponding with the event parameter // that is available in event bindings. Since this variable is a parameter of the handler // function that the converted expression becomes a child of, just create a reference to the diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.ts index a121bd46df..6fffff4a05 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.ts @@ -77,7 +77,7 @@ export class TypeCheckFile extends Environment { return source; } - getPreludeStatements(): ts.Statement[] { + override getPreludeStatements(): ts.Statement[] { return []; } } diff --git a/packages/compiler-cli/src/ngtsc/util/src/visitor.ts b/packages/compiler-cli/src/ngtsc/util/src/visitor.ts index 9ce64e6ec9..dac65adeed 100644 --- a/packages/compiler-cli/src/ngtsc/util/src/visitor.ts +++ b/packages/compiler-cli/src/ngtsc/util/src/visitor.ts @@ -45,10 +45,8 @@ export abstract class Visitor { * Visit a class declaration, returning at least the transformed declaration and optionally other * nodes to insert before the declaration. */ - visitClassDeclaration(node: ts.ClassDeclaration): - VisitListEntryResult { - return {node}; - } + abstract visitClassDeclaration(node: ts.ClassDeclaration): + VisitListEntryResult; private _visitListEntryNode( node: T, visitor: (node: T) => VisitListEntryResult): T { diff --git a/packages/compiler-cli/test/metadata/typescript.mocks.ts b/packages/compiler-cli/test/metadata/typescript.mocks.ts index 7b9e1e1434..657ac8ec60 100644 --- a/packages/compiler-cli/test/metadata/typescript.mocks.ts +++ b/packages/compiler-cli/test/metadata/typescript.mocks.ts @@ -149,9 +149,6 @@ export class MockNode implements ts.Node { export class MockIdentifier extends MockNode implements ts.Identifier { originalKeywordKind?: ts.SyntaxKind; isInJSDocNamespace?: boolean; - decorators?: ts.NodeArray; - modifiers?: ts.NodeArray; - parent!: ts.Node; public text: string; // TODO(issue/24571): remove '!'. public escapedText!: ts.__String; @@ -167,7 +164,8 @@ export class MockIdentifier extends MockNode implements ts.Identifier { // tslint:enable constructor( - public name: string, public kind: ts.SyntaxKind.Identifier = ts.SyntaxKind.Identifier, + public name: string, + public override kind: ts.SyntaxKind.Identifier = ts.SyntaxKind.Identifier, flags: ts.NodeFlags = 0, pos: number = 0, end: number = 0) { super(kind, flags, pos, end); this.text = name; @@ -175,18 +173,16 @@ export class MockIdentifier extends MockNode implements ts.Identifier { } export class MockVariableDeclaration extends MockNode implements ts.VariableDeclaration { - parent!: ts.VariableDeclarationList|ts.CatchClause; + override parent!: ts.VariableDeclarationList|ts.CatchClause; exclamationToken?: ts.Token; type?: ts.TypeNode; initializer?: ts.Expression; - decorators?: ts.NodeArray; - modifiers?: ts.NodeArray; // tslint:disable-next-line public _declarationBrand: any; constructor( public name: ts.Identifier, - public kind: ts.SyntaxKind.VariableDeclaration = ts.SyntaxKind.VariableDeclaration, + public override kind: ts.SyntaxKind.VariableDeclaration = ts.SyntaxKind.VariableDeclaration, flags: ts.NodeFlags = 0, pos: number = 0, end: number = 0) { super(kind, flags, pos, end); } diff --git a/packages/compiler-cli/test/ngtsc/env.ts b/packages/compiler-cli/test/ngtsc/env.ts index 27db4c96a8..d1f4271642 100644 --- a/packages/compiler-cli/test/ngtsc/env.ts +++ b/packages/compiler-cli/test/ngtsc/env.ts @@ -329,7 +329,7 @@ class MultiCompileHostExt extends AugmentedCompilerHost implements Partial(); private writtenFiles = new Set(); - getSourceFile( + override getSourceFile( fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): ts.SourceFile|undefined { if (this.cache.has(fileName)) { @@ -346,7 +346,7 @@ class MultiCompileHostExt extends AugmentedCompilerHost implements Partial void)|undefined, sourceFiles?: ReadonlyArray): void {