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
This commit is contained in:
parent
96c93260a2
commit
ccbb913f4b
|
@ -30,7 +30,7 @@ export class IifeEmitScope<TStatement, TExpression> extends EmitScope<TStatement
|
|||
* Wraps the output from `EmitScope.translateDefinition()` and `EmitScope.getConstantStatements()`
|
||||
* in an IIFE.
|
||||
*/
|
||||
translateDefinition(definition: o.Expression): TExpression {
|
||||
override translateDefinition(definition: o.Expression): TExpression {
|
||||
const constantStatements = super.getConstantStatements();
|
||||
|
||||
const returnStatement =
|
||||
|
@ -44,7 +44,7 @@ export class IifeEmitScope<TStatement, TExpression> extends EmitScope<TStatement
|
|||
* It is not valid to call this method, since there will be no shared constant statements - they
|
||||
* are already emitted in the IIFE alongside the translated definition.
|
||||
*/
|
||||
getConstantStatements(): TStatement[] {
|
||||
override getConstantStatements(): TStatement[] {
|
||||
throw new Error('BUG - IifeEmitScope should not expose any constant statements');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ export class DtsDependencyHost extends EsmDependencyHost {
|
|||
/**
|
||||
* Attempts to process the `importPath` directly and also inside `@types/...`.
|
||||
*/
|
||||
protected processImport(
|
||||
protected override processImport(
|
||||
importPath: string, file: AbsoluteFsPath, dependencies: Set<AbsoluteFsPath>,
|
||||
missing: Set<string>, deepImports: Set<string>, alreadySeen: Set<AbsoluteFsPath>): boolean {
|
||||
return super.processImport(importPath, file, dependencies, missing, deepImports, alreadySeen) ||
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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(' ')}`;
|
||||
}
|
||||
|
|
|
@ -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<string, Declaration>|null {
|
||||
override getExportsOfModule(module: ts.Node): Map<string, Declaration>|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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<T extends Declaration>(decl: T): T {
|
||||
override detectKnownDeclaration<T extends Declaration>(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) : [];
|
||||
}
|
||||
|
|
|
@ -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<string, Declaration>|null {
|
||||
override getExportsOfModule(module: ts.Node): Map<string, Declaration>|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<ts.Symbol, NgccClassSymbol>, 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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -323,7 +323,8 @@ class TestHandler implements DecoratorHandler<unknown, unknown, null, unknown> {
|
|||
}
|
||||
|
||||
class AlwaysDetectHandler extends TestHandler {
|
||||
detect(node: ClassDeclaration, decorators: Decorator[]|null): DetectResult<unknown>|undefined {
|
||||
override detect(node: ClassDeclaration, decorators: Decorator[]|null):
|
||||
DetectResult<unknown>|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<unknown>|undefined {
|
||||
override detect(node: ClassDeclaration, decorators: Decorator[]|null):
|
||||
DetectResult<unknown>|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<any> {
|
||||
override analyze(node: ClassDeclaration): AnalysisOutput<any> {
|
||||
super.analyze(node);
|
||||
return {diagnostics: [makeDiagnostic(9999, node, 'test diagnostic')]};
|
||||
}
|
||||
|
|
|
@ -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}'.`);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -123,7 +123,8 @@ export class ComponentSymbol extends DirectiveSymbol {
|
|||
usedPipes: SemanticReference[] = [];
|
||||
isRemotelyScoped = false;
|
||||
|
||||
isEmitAffected(previousSymbol: SemanticSymbol, publicApiAffected: Set<SemanticSymbol>): boolean {
|
||||
override isEmitAffected(previousSymbol: SemanticSymbol, publicApiAffected: Set<SemanticSymbol>):
|
||||
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<SemanticSymbol>): boolean {
|
||||
if (!(previousSymbol instanceof ComponentSymbol)) {
|
||||
return true;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ runInEachFileSystem(() => {
|
|||
super(checker);
|
||||
}
|
||||
|
||||
hasBaseClass(_class: ClassDeclaration): boolean {
|
||||
override hasBaseClass(_class: ClassDeclaration): boolean {
|
||||
return hasBaseClass;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<string, Declaration>|null {
|
||||
override getExportsOfModule(node: ts.Node): Map<string, Declaration>|null {
|
||||
const realExports = super.getExportsOfModule(node);
|
||||
if (realExports === null) {
|
||||
return null;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<string, Declaration>|null {
|
||||
override getExportsOfModule(node: ts.Node): Map<string, Declaration>|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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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<ClassDeclaration<ts.ClassDeclaration>>;
|
||||
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<ClassDeclaration<ts.ClassDeclaration>>;
|
||||
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
|
||||
|
|
|
@ -77,7 +77,7 @@ export class TypeCheckFile extends Environment {
|
|||
return source;
|
||||
}
|
||||
|
||||
getPreludeStatements(): ts.Statement[] {
|
||||
override getPreludeStatements(): ts.Statement[] {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<ts.Statement, ts.ClassDeclaration> {
|
||||
return {node};
|
||||
}
|
||||
abstract visitClassDeclaration(node: ts.ClassDeclaration):
|
||||
VisitListEntryResult<ts.Statement, ts.ClassDeclaration>;
|
||||
|
||||
private _visitListEntryNode<T extends ts.Statement>(
|
||||
node: T, visitor: (node: T) => VisitListEntryResult<ts.Statement, T>): T {
|
||||
|
|
|
@ -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<ts.Decorator>;
|
||||
modifiers?: ts.NodeArray<ts.Modifier>;
|
||||
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<ts.SyntaxKind.ExclamationToken>;
|
||||
type?: ts.TypeNode;
|
||||
initializer?: ts.Expression;
|
||||
decorators?: ts.NodeArray<ts.Decorator>;
|
||||
modifiers?: ts.NodeArray<ts.Modifier>;
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ class MultiCompileHostExt extends AugmentedCompilerHost implements Partial<ts.Co
|
|||
private cache = new Map<string, ts.SourceFile>();
|
||||
private writtenFiles = new Set<string>();
|
||||
|
||||
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<ts.Co
|
|||
this.writtenFiles.clear();
|
||||
}
|
||||
|
||||
writeFile(
|
||||
override writeFile(
|
||||
fileName: string, data: string, writeByteOrderMark: boolean,
|
||||
onError: ((message: string) => void)|undefined,
|
||||
sourceFiles?: ReadonlyArray<ts.SourceFile>): void {
|
||||
|
|
Loading…
Reference in New Issue