refactor: add override keyword to members implementing abstract declarations (#42512)

In combination with the TS `noImplicitOverride` compatibility changes,
we also want to follow the best-practice of adding `override` to
members which are implemented as part of abstract classes. This
commit fixes all instances which will be flagged as part of the
custom `no-implicit-override-abstract` TSLint rule.

PR Close #42512
This commit is contained in:
Paul Gschwendtner 2021-07-07 19:58:22 +02:00 committed by Andrew Kushnir
parent 04642e7985
commit b5ab7aff43
113 changed files with 517 additions and 511 deletions

View File

@ -13,10 +13,10 @@ const exampleData = 'this is example data' as const;
/** A simple usage of the BaseModule to illustrate the workings built into the abstract class. */
class ConcreteBaseModule extends BaseModule<typeof exampleData> {
async retrieveData() {
override async retrieveData() {
return exampleData;
}
async printToTerminal() {}
override async printToTerminal() {}
}
describe('BaseModule', () => {

View File

@ -25,7 +25,7 @@ type CiData = {
}[];
export class CiModule extends BaseModule<CiData> {
async retrieveData() {
override async retrieveData() {
const gitRepoWithApi = {api: this.git.github, ...this.git.remoteConfig};
const releaseTrains = await fetchActiveReleaseTrains(gitRepoWithApi);
@ -52,7 +52,7 @@ export class CiModule extends BaseModule<CiData> {
return await Promise.all(ciResultPromises);
}
async printToTerminal() {
override async printToTerminal() {
const data = await this.data;
const minLabelLength = Math.max(...data.map(result => result.label.length));
info.group(bold(`CI`));

View File

@ -23,7 +23,7 @@ export interface G3StatsData {
}
export class G3Module extends BaseModule<G3StatsData|void> {
async retrieveData() {
override async retrieveData() {
const toCopyToG3 = this.getG3FileIncludeAndExcludeLists();
const latestSha = this.getLatestShas();
@ -35,7 +35,7 @@ export class G3Module extends BaseModule<G3StatsData|void> {
latestSha.g3, latestSha.master, toCopyToG3.include, toCopyToG3.exclude);
}
async printToTerminal() {
override async printToTerminal() {
const stats = await this.data;
if (!stats) {
return;

View File

@ -45,7 +45,7 @@ type GithubQueryResult = {
const MAX_RETURNED_ISSUES = 20;
export class GithubQueriesModule extends BaseModule<GithubQueryResults|void> {
async retrieveData() {
override async retrieveData() {
// Non-null assertion is used here as the check for undefined immediately follows to confirm the
// assertion. Typescript's type filtering does not seem to work as needed to understand
// whether githubQueries is undefined or not.
@ -95,7 +95,7 @@ export class GithubQueriesModule extends BaseModule<GithubQueryResults|void> {
return graphqlQuery;
}
async printToTerminal() {
override async printToTerminal() {
const queryResults = await this.data;
if (!queryResults) {
return;

View File

@ -45,11 +45,11 @@ export const services: ServiceConfig[] = [
];
export class ServicesModule extends BaseModule<StatusCheckResult[]> {
async retrieveData() {
override async retrieveData() {
return Promise.all(services.map(service => this.getStatusFromStandardApi(service)));
}
async printToTerminal() {
override async printToTerminal() {
const statuses = await this.data;
const serviceNameMinLength = Math.max(...statuses.map(service => service.name.length));
info.group(bold('Service Statuses'));

View File

@ -16,13 +16,13 @@ import {Formatter} from './base-formatter';
* Formatter for running buildifier against bazel related files.
*/
export class Buildifier extends Formatter {
name = 'buildifier';
override name = 'buildifier';
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/buildifier');
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/buildifier');
defaultFileMatcher = ['**/*.bzl', '**/BUILD.bazel', '**/WORKSPACE', '**/BUILD'];
override defaultFileMatcher = ['**/*.bzl', '**/BUILD.bazel', '**/WORKSPACE', '**/BUILD'];
actions = {
override actions = {
check: {
commandFlags: `${BAZEL_WARNING_FLAG} --lint=warn --mode=check --format=json`,
callback:

View File

@ -16,13 +16,13 @@ import {Formatter} from './base-formatter';
* Formatter for running clang-format against Typescript and Javascript files
*/
export class ClangFormat extends Formatter {
name = 'clang-format';
override name = 'clang-format';
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');
defaultFileMatcher = ['**/*.{t,j}s'];
override defaultFileMatcher = ['**/*.{t,j}s'];
actions = {
override actions = {
check: {
commandFlags: `--Werror -n -style=file`,
callback:

View File

@ -17,11 +17,11 @@ import {Formatter} from './base-formatter';
* Formatter for running prettier against Typescript and Javascript files.
*/
export class Prettier extends Formatter {
name = 'prettier';
override name = 'prettier';
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/prettier');
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/prettier');
defaultFileMatcher = ['**/*.{t,j}s'];
override defaultFileMatcher = ['**/*.{t,j}s'];
/**
* The configuration path of the prettier config, obtained during construction to prevent needing
@ -30,7 +30,7 @@ export class Prettier extends Formatter {
private configPath =
this.config['prettier'] ? exec(`${this.binaryFilePath} --find-config-path .`).trim() : '';
actions = {
override actions = {
check: {
commandFlags: `--config ${this.configPath} --check`,
callback:

View File

@ -44,7 +44,7 @@ export class GithubApiMergeStrategy extends MergeStrategy {
super(git);
}
async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
override async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
const {githubTargetBranch, prNumber, targetBranches, requiredBaseSha, needsCommitMessageFixup} =
pullRequest;
// If the pull request does not have its base branch set to any determined target

View File

@ -31,7 +31,7 @@ export class AutosquashMergeStrategy extends MergeStrategy {
* specific to the pull request merge.
* @returns A pull request failure or null in case of success.
*/
async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
override async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
const {prNumber, targetBranches, requiredBaseSha, needsCommitMessageFixup, githubTargetBranch} =
pullRequest;
// In case a required base is specified for this pull request, check if the pull

View File

@ -21,13 +21,13 @@ import {packageJsonPath} from '../constants';
export class ConfigureNextAsMajorAction extends ReleaseAction {
private _newVersion = semver.parse(`${this.active.next.version.major + 1}.0.0-next.0`)!;
async getDescription() {
override async getDescription() {
const {branchName} = this.active.next;
const newVersion = this._newVersion;
return `Configure the "${branchName}" branch to be released as major (v${newVersion}).`;
}
async perform() {
override async perform() {
const {branchName} = this.active.next;
const newVersion = this._newVersion;

View File

@ -22,12 +22,12 @@ export class CutLongTermSupportPatchAction extends ReleaseAction {
/** Promise resolving an object describing long-term support branches. */
ltsBranches = fetchLongTermSupportBranchesFromNpm(this.config);
async getDescription() {
override async getDescription() {
const {active} = await this.ltsBranches;
return `Cut a new release for an active LTS branch (${active.length} active).`;
}
async perform() {
override async perform() {
const ltsBranch = await this._promptForTargetLtsBranch();
const newVersion = semverInc(ltsBranch.version, 'patch');
const {pullRequest: {id}, releaseNotes} =

View File

@ -18,13 +18,13 @@ import {ReleaseAction} from '../actions';
export class CutNewPatchAction extends ReleaseAction {
private _newVersion = semverInc(this.active.latest.version, 'patch');
async getDescription() {
override async getDescription() {
const {branchName} = this.active.latest;
const newVersion = this._newVersion;
return `Cut a new patch release for the "${branchName}" branch (v${newVersion}).`;
}
async perform() {
override async perform() {
const {branchName} = this.active.latest;
const newVersion = this._newVersion;

View File

@ -21,13 +21,13 @@ export class CutNextPrereleaseAction extends ReleaseAction {
/** Promise resolving with the new version if a NPM next pre-release is cut. */
private _newVersion: Promise<semver.SemVer> = this._computeNewVersion();
async getDescription() {
override async getDescription() {
const {branchName} = this._getActivePrereleaseTrain();
const newVersion = await this._newVersion;
return `Cut a new next pre-release for the "${branchName}" branch (v${newVersion}).`;
}
async perform() {
override async perform() {
const releaseTrain = this._getActivePrereleaseTrain();
const {branchName} = releaseTrain;
const newVersion = await this._newVersion;

View File

@ -17,12 +17,12 @@ import {ReleaseAction} from '../actions';
export class CutReleaseCandidateAction extends ReleaseAction {
private _newVersion = semverInc(this.active.releaseCandidate!.version, 'prerelease', 'rc');
async getDescription() {
override async getDescription() {
const newVersion = this._newVersion;
return `Cut a first release-candidate for the feature-freeze branch (v${newVersion}).`;
}
async perform() {
override async perform() {
const {branchName} = this.active.releaseCandidate!;
const newVersion = this._newVersion;

View File

@ -20,12 +20,12 @@ import {invokeSetNpmDistCommand, invokeYarnInstallCommand} from '../external-com
export class CutStableAction extends ReleaseAction {
private _newVersion = this._computeNewVersion();
async getDescription() {
override async getDescription() {
const newVersion = this._newVersion;
return `Cut a stable release for the release-candidate branch (v${newVersion}).`;
}
async perform() {
override async perform() {
const {branchName} = this.active.releaseCandidate!;
const newVersion = this._newVersion;
const isNewMajor = this.active.releaseCandidate?.isMajor;

View File

@ -24,13 +24,13 @@ import {changelogPath, packageJsonPath} from '../constants';
export class MoveNextIntoFeatureFreezeAction extends ReleaseAction {
private _newVersion = computeNewPrereleaseVersionForNext(this.active, this.config);
async getDescription() {
override async getDescription() {
const {branchName} = this.active.next;
const newVersion = await this._newVersion;
return `Move the "${branchName}" branch into feature-freeze phase (v${newVersion}).`;
}
async perform() {
override async perform() {
const newVersion = await this._newVersion;
const newBranch = `${newVersion.major}.${newVersion.minor}.x`;

View File

@ -25,11 +25,11 @@ import {invokeSetNpmDistCommand, invokeYarnInstallCommand} from '../external-com
* @see {CutStableAction#perform} for more details.
*/
export class TagRecentMajorAsLatest extends ReleaseAction {
async getDescription() {
override async getDescription() {
return `Tag recently published major v${this.active.latest.version} as "next" in NPM.`;
}
async perform() {
override async perform() {
await this.checkoutUpstreamBranch(this.active.latest.branchName);
await invokeYarnInstallCommand(this.projectDir);
await invokeSetNpmDistCommand('latest', this.active.latest.version);

View File

@ -143,11 +143,11 @@ describe('common release action logic', () => {
* release action class. This allows us to add unit tests.
*/
class TestAction extends ReleaseAction {
async getDescription() {
override async getDescription() {
return 'Test action';
}
async perform() {
override async perform() {
throw Error('Not implemented.');
}

View File

@ -10,11 +10,11 @@ import {dashCaseToCamelCase} from '../../util';
import {AnimationStyleNormalizer} from './animation_style_normalizer';
export class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {
normalizePropertyName(propertyName: string, errors: string[]): string {
override normalizePropertyName(propertyName: string, errors: string[]): string {
return dashCaseToCamelCase(propertyName);
}
normalizeStyleValue(
override normalizeStyleValue(
userProvidedProperty: string, normalizedProperty: string, value: string|number,
errors: string[]): string {
let unit: string = '';

View File

@ -110,11 +110,11 @@ class SuffixNormalizer extends AnimationStyleNormalizer {
super();
}
normalizePropertyName(propertyName: string, errors: string[]): string {
override normalizePropertyName(propertyName: string, errors: string[]): string {
return propertyName + this._suffix;
}
normalizeStyleValue(
override normalizeStyleValue(
userProvidedProperty: string, normalizedProperty: string, value: string|number,
errors: string[]): string {
return value + this._suffix;

View File

@ -693,11 +693,11 @@ class SuffixNormalizer extends AnimationStyleNormalizer {
super();
}
normalizePropertyName(propertyName: string, errors: string[]): string {
override normalizePropertyName(propertyName: string, errors: string[]): string {
return propertyName + this._suffix;
}
normalizeStyleValue(
override normalizeStyleValue(
userProvidedProperty: string, normalizedProperty: string, value: string|number,
errors: string[]): string {
return value + this._suffix;
@ -709,14 +709,14 @@ class ExactCssValueNormalizer extends AnimationStyleNormalizer {
super();
}
normalizePropertyName(propertyName: string, errors: string[]): string {
override normalizePropertyName(propertyName: string, errors: string[]): string {
if (!this._allowedValues[propertyName]) {
errors.push(`The CSS property \`${propertyName}\` is not allowed`);
}
return propertyName;
}
normalizeStyleValue(
override normalizeStyleValue(
userProvidedProperty: string, normalizedProperty: string, value: string|number,
errors: string[]): string {
const expectedValue = this._allowedValues[userProvidedProperty];

View File

@ -17,7 +17,7 @@ class SampleTokenExtractor extends HttpXsrfTokenExtractor {
super();
}
getToken(): string|null {
override getToken(): string|null {
return this.token;
}
}

View File

@ -56,7 +56,7 @@ export class NgLocaleLocalization extends NgLocalization {
super();
}
getPluralCategory(value: any, locale?: string): string {
override getPluralCategory(value: any, locale?: string): string {
const plural = getLocalePluralCase(locale || this.locale)(value);
switch (plural) {

View File

@ -52,16 +52,16 @@ export class HashLocationStrategy extends LocationStrategy implements OnDestroy
}
}
onPopState(fn: LocationChangeListener): void {
override onPopState(fn: LocationChangeListener): void {
this._removeListenerFns.push(
this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
}
getBaseHref(): string {
override getBaseHref(): string {
return this._baseHref;
}
path(includeHash: boolean = false): string {
override path(includeHash: boolean = false): string {
// the hash value is always prefixed with a `#`
// and if it is empty then it will stay empty
let path = this._platformLocation.hash;
@ -70,12 +70,12 @@ export class HashLocationStrategy extends LocationStrategy implements OnDestroy
return path.length > 0 ? path.substring(1) : path;
}
prepareExternalUrl(internal: string): string {
override prepareExternalUrl(internal: string): string {
const url = joinWithSlash(this._baseHref, internal);
return url.length > 0 ? ('#' + url) : url;
}
pushState(state: any, title: string, path: string, queryParams: string) {
override pushState(state: any, title: string, path: string, queryParams: string) {
let url: string|null = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
@ -83,7 +83,7 @@ export class HashLocationStrategy extends LocationStrategy implements OnDestroy
this._platformLocation.pushState(state, title, url);
}
replaceState(state: any, title: string, path: string, queryParams: string) {
override replaceState(state: any, title: string, path: string, queryParams: string) {
let url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
@ -91,11 +91,11 @@ export class HashLocationStrategy extends LocationStrategy implements OnDestroy
this._platformLocation.replaceState(state, title, url);
}
forward(): void {
override forward(): void {
this._platformLocation.forward();
}
back(): void {
override back(): void {
this._platformLocation.back();
}

View File

@ -135,41 +135,41 @@ export class PathLocationStrategy extends LocationStrategy implements OnDestroy
}
}
onPopState(fn: LocationChangeListener): void {
override onPopState(fn: LocationChangeListener): void {
this._removeListenerFns.push(
this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
}
getBaseHref(): string {
override getBaseHref(): string {
return this._baseHref;
}
prepareExternalUrl(internal: string): string {
override prepareExternalUrl(internal: string): string {
return joinWithSlash(this._baseHref, internal);
}
path(includeHash: boolean = false): string {
override path(includeHash: boolean = false): string {
const pathname =
this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
const hash = this._platformLocation.hash;
return hash && includeHash ? `${pathname}${hash}` : pathname;
}
pushState(state: any, title: string, url: string, queryParams: string) {
override pushState(state: any, title: string, url: string, queryParams: string) {
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
}
replaceState(state: any, title: string, url: string, queryParams: string) {
override replaceState(state: any, title: string, url: string, queryParams: string) {
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
}
forward(): void {
override forward(): void {
this._platformLocation.forward();
}
back(): void {
override back(): void {
this._platformLocation.back();
}

View File

@ -128,48 +128,48 @@ export class BrowserPlatformLocation extends PlatformLocation {
this._history = window.history;
}
getBaseHrefFromDOM(): string {
override getBaseHrefFromDOM(): string {
return getDOM().getBaseHref(this._doc)!;
}
onPopState(fn: LocationChangeListener): VoidFunction {
override onPopState(fn: LocationChangeListener): VoidFunction {
const window = getDOM().getGlobalEventTarget(this._doc, 'window');
window.addEventListener('popstate', fn, false);
return () => window.removeEventListener('popstate', fn);
}
onHashChange(fn: LocationChangeListener): VoidFunction {
override onHashChange(fn: LocationChangeListener): VoidFunction {
const window = getDOM().getGlobalEventTarget(this._doc, 'window');
window.addEventListener('hashchange', fn, false);
return () => window.removeEventListener('hashchange', fn);
}
get href(): string {
override get href(): string {
return this.location.href;
}
get protocol(): string {
override get protocol(): string {
return this.location.protocol;
}
get hostname(): string {
override get hostname(): string {
return this.location.hostname;
}
get port(): string {
override get port(): string {
return this.location.port;
}
get pathname(): string {
override get pathname(): string {
return this.location.pathname;
}
get search(): string {
override get search(): string {
return this.location.search;
}
get hash(): string {
override get hash(): string {
return this.location.hash;
}
set pathname(newPath: string) {
override set pathname(newPath: string) {
this.location.pathname = newPath;
}
pushState(state: any, title: string, url: string): void {
override pushState(state: any, title: string, url: string): void {
if (supportsState()) {
this._history.pushState(state, title, url);
} else {
@ -177,7 +177,7 @@ export class BrowserPlatformLocation extends PlatformLocation {
}
}
replaceState(state: any, title: string, url: string): void {
override replaceState(state: any, title: string, url: string): void {
if (supportsState()) {
this._history.replaceState(state, title, url);
} else {
@ -185,11 +185,11 @@ export class BrowserPlatformLocation extends PlatformLocation {
}
}
forward(): void {
override forward(): void {
this._history.forward();
}
back(): void {
override back(): void {
this._history.back();
}
@ -197,7 +197,7 @@ export class BrowserPlatformLocation extends PlatformLocation {
this._history.go(relativePosition);
}
getState(): unknown {
override getState(): unknown {
return this._history.state;
}
}

View File

@ -16,11 +16,11 @@ import {DependencyHostBase} from './dependency_host';
* Helper functions for computing dependencies.
*/
export class CommonJsDependencyHost extends DependencyHostBase {
protected canSkipFile(fileContents: string): boolean {
protected override canSkipFile(fileContents: string): boolean {
return !hasRequireCalls(fileContents);
}
protected extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
protected override extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
// Parse the source into a TypeScript AST and then walk it looking for imports and re-exports.
const sf =
ts.createSourceFile(file, fileContents, ts.ScriptTarget.ES2015, false, ts.ScriptKind.JS);

View File

@ -23,7 +23,7 @@ export class EsmDependencyHost extends DependencyHostBase {
// It has no relevance to capturing imports.
private scanner = ts.createScanner(ts.ScriptTarget.Latest, /* skipTrivia */ true);
protected canSkipFile(fileContents: string): boolean {
protected override canSkipFile(fileContents: string): boolean {
return !hasImportOrReexportStatements(fileContents);
}
@ -43,7 +43,7 @@ export class EsmDependencyHost extends DependencyHostBase {
* Specifically, backticked strings are particularly challenging since it is possible
* to recursively nest backticks and TypeScript expressions within each other.
*/
protected extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
protected override extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
const imports = new Set<string>();
const templateStack: ts.SyntaxKind[] = [];
let lastToken: ts.SyntaxKind = ts.SyntaxKind.Unknown;

View File

@ -17,11 +17,11 @@ import {DependencyHostBase} from './dependency_host';
* Helper functions for computing dependencies.
*/
export class UmdDependencyHost extends DependencyHostBase {
protected canSkipFile(fileContents: string): boolean {
protected override canSkipFile(fileContents: string): boolean {
return !hasRequireCalls(fileContents);
}
protected extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
protected override extractImports(file: AbsoluteFsPath, fileContents: string): Set<string> {
// Parse the source into a TypeScript AST and then walk it looking for imports and re-exports.
const sf =
ts.createSourceFile(file, fileContents, ts.ScriptTarget.ES2015, false, ts.ScriptKind.JS);

View File

@ -45,7 +45,7 @@ export class ProgramBasedEntryPointFinder extends TracingEntryPointFinder {
* Return an array containing the external import paths that were extracted from the source-files
* of the program defined by the tsconfig.json.
*/
protected getInitialEntryPointPaths(): AbsoluteFsPath[] {
protected override getInitialEntryPointPaths(): AbsoluteFsPath[] {
const moduleResolver = new ModuleResolver(this.fs, this.pathMappings, ['', '.ts', '/index.ts']);
const host = new EsmDependencyHost(this.fs, moduleResolver);
const dependencies = createDependencyInfo();
@ -71,7 +71,8 @@ export class ProgramBasedEntryPointFinder extends TracingEntryPointFinder {
* @returns the entry-point and its dependencies or `null` if the entry-point is not compiled by
* Angular or cannot be determined.
*/
protected getEntryPointWithDeps(entryPointPath: AbsoluteFsPath): EntryPointWithDependencies|null {
protected override getEntryPointWithDeps(entryPointPath: AbsoluteFsPath):
EntryPointWithDependencies|null {
const entryPoints = this.findOrLoadEntryPoints();
if (!entryPoints.has(entryPointPath)) {
return null;

View File

@ -83,7 +83,7 @@ export class TargetedEntryPointFinder extends TracingEntryPointFinder {
/**
* Return an array containing the `targetPath` from which to start the trace.
*/
protected getInitialEntryPointPaths(): AbsoluteFsPath[] {
protected override getInitialEntryPointPaths(): AbsoluteFsPath[] {
return [this.targetPath];
}
@ -97,7 +97,8 @@ export class TargetedEntryPointFinder extends TracingEntryPointFinder {
* @returns the entry-point and its dependencies or `null` if the entry-point is not compiled by
* Angular or cannot be determined.
*/
protected getEntryPointWithDeps(entryPointPath: AbsoluteFsPath): EntryPointWithDependencies|null {
protected override getEntryPointWithDeps(entryPointPath: AbsoluteFsPath):
EntryPointWithDependencies|null {
const packagePath = this.computePackagePath(entryPointPath);
const entryPoint =
getEntryPointInfo(this.fs, this.config, this.logger, packagePath, entryPointPath);

View File

@ -27,7 +27,7 @@ export class ParallelTaskQueue extends BaseTaskQueue {
this.blockedTasks = getBlockedTasks(dependencies);
}
computeNextTask(): Task|null {
override computeNextTask(): Task|null {
// Look for the first available (i.e. not blocked) task.
// (NOTE: Since tasks are sorted by priority, the first available one is the best choice.)
const nextTaskIdx = this.tasks.findIndex(task => !this.blockedTasks.has(task));

View File

@ -17,7 +17,7 @@ import {BaseTaskQueue} from './base_task_queue';
* before requesting the next one.
*/
export class SerialTaskQueue extends BaseTaskQueue {
computeNextTask(): Task|null {
override computeNextTask(): Task|null {
const nextTask = this.tasks.shift() || null;
if (nextTask) {

View File

@ -64,7 +64,7 @@ export class DirectiveSymbol extends SemanticSymbol {
super(decl);
}
isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
override isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
// Note: since components and directives have exactly the same items contributing to their
// public API, it is okay for a directive to change into a component and vice versa without
// the API being affected.
@ -83,7 +83,7 @@ export class DirectiveSymbol extends SemanticSymbol {
!isArrayEqual(this.exportAs, previousSymbol.exportAs);
}
isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
override isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
// If the public API of the directive has changed, then so has its type-check API.
if (this.isPublicApiAffected(previousSymbol)) {
return true;

View File

@ -58,7 +58,7 @@ export class NgModuleSymbol extends SemanticSymbol {
usedPipes: SemanticReference[]
}[] = [];
isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
override isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
if (!(previousSymbol instanceof NgModuleSymbol)) {
return true;
}
@ -104,7 +104,7 @@ export class NgModuleSymbol extends SemanticSymbol {
return false;
}
isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
override isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
if (!(previousSymbol instanceof NgModuleSymbol)) {
return true;
}

View File

@ -38,7 +38,7 @@ export class PipeSymbol extends SemanticSymbol {
super(decl);
}
isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
override isPublicApiAffected(previousSymbol: SemanticSymbol): boolean {
if (!(previousSymbol instanceof PipeSymbol)) {
return true;
}
@ -46,7 +46,7 @@ export class PipeSymbol extends SemanticSymbol {
return this.name !== previousSymbol.name;
}
isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
override isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean {
return this.isPublicApiAffected(previousSymbol);
}
}

View File

@ -21,20 +21,20 @@ export class MockFileSystemNative extends MockFileSystem {
// Delegate to the real NodeJSFileSystem for these path related methods
resolve(...paths: string[]): AbsoluteFsPath {
override resolve(...paths: string[]): AbsoluteFsPath {
return NodeJSFileSystem.prototype.resolve.call(this, this.pwd(), ...paths);
}
dirname<T extends string>(file: T): T {
override dirname<T extends string>(file: T): T {
return NodeJSFileSystem.prototype.dirname.call(this, file) as T;
}
join<T extends string>(basePath: T, ...paths: string[]): T {
override join<T extends string>(basePath: T, ...paths: string[]): T {
return NodeJSFileSystem.prototype.join.call(this, basePath, ...paths) as T;
}
relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
override relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
return NodeJSFileSystem.prototype.relative.call(this, from, to);
}
basename(filePath: string, extension?: string): PathSegment {
override basename(filePath: string, extension?: string): PathSegment {
return NodeJSFileSystem.prototype.basename.call(this, filePath, extension);
}
@ -42,7 +42,7 @@ export class MockFileSystemNative extends MockFileSystem {
return NodeJSFileSystem.prototype.isCaseSensitive.call(this);
}
isRooted(path: string): boolean {
override isRooted(path: string): boolean {
return NodeJSFileSystem.prototype.isRooted.call(this, path);
}
@ -50,7 +50,7 @@ export class MockFileSystemNative extends MockFileSystem {
return NodeJSFileSystem.prototype.isRoot.call(this, path);
}
normalize<T extends PathString>(path: T): T {
override normalize<T extends PathString>(path: T): T {
// When running in Windows, absolute paths are normalized to always include a drive letter. This
// ensures that rooted posix paths used in tests will be normalized to real Windows paths, i.e.
// including a drive letter. Note that the same normalization is done in emulated Windows mode
@ -63,7 +63,7 @@ export class MockFileSystemNative extends MockFileSystem {
return NodeJSFileSystem.prototype.normalize.call(this, path) as T;
}
protected splitPath<T>(path: string): string[] {
protected override splitPath<T>(path: string): string[] {
return path.split(/[\\\/]/);
}
}

View File

@ -12,36 +12,36 @@ import {AbsoluteFsPath, PathSegment, PathString} from '../../src/types';
import {MockFileSystem} from './mock_file_system';
export class MockFileSystemPosix extends MockFileSystem {
resolve(...paths: string[]): AbsoluteFsPath {
override resolve(...paths: string[]): AbsoluteFsPath {
const resolved = p.posix.resolve(this.pwd(), ...paths);
return this.normalize(resolved) as AbsoluteFsPath;
}
dirname<T extends string>(file: T): T {
override dirname<T extends string>(file: T): T {
return this.normalize(p.posix.dirname(file)) as T;
}
join<T extends string>(basePath: T, ...paths: string[]): T {
override join<T extends string>(basePath: T, ...paths: string[]): T {
return this.normalize(p.posix.join(basePath, ...paths)) as T;
}
relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
override relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
return this.normalize(p.posix.relative(from, to)) as PathSegment | AbsoluteFsPath;
}
basename(filePath: string, extension?: string): PathSegment {
override basename(filePath: string, extension?: string): PathSegment {
return p.posix.basename(filePath, extension) as PathSegment;
}
isRooted(path: string): boolean {
override isRooted(path: string): boolean {
return path.startsWith('/');
}
protected splitPath<T extends PathString>(path: T): string[] {
protected override splitPath<T extends PathString>(path: T): string[] {
return path.split('/');
}
normalize<T extends PathString>(path: T): T {
override normalize<T extends PathString>(path: T): T {
return path.replace(/^[a-z]:\//i, '/').replace(/\\/g, '/') as T;
}
}

View File

@ -12,36 +12,36 @@ import {AbsoluteFsPath, PathSegment, PathString} from '../../src/types';
import {MockFileSystem} from './mock_file_system';
export class MockFileSystemWindows extends MockFileSystem {
resolve(...paths: string[]): AbsoluteFsPath {
override resolve(...paths: string[]): AbsoluteFsPath {
const resolved = p.win32.resolve(this.pwd(), ...paths);
return this.normalize(resolved as AbsoluteFsPath);
}
dirname<T extends string>(path: T): T {
override dirname<T extends string>(path: T): T {
return this.normalize(p.win32.dirname(path) as T);
}
join<T extends string>(basePath: T, ...paths: string[]): T {
override join<T extends string>(basePath: T, ...paths: string[]): T {
return this.normalize(p.win32.join(basePath, ...paths)) as T;
}
relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
override relative<T extends PathString>(from: T, to: T): PathSegment|AbsoluteFsPath {
return this.normalize(p.win32.relative(from, to)) as PathSegment | AbsoluteFsPath;
}
basename(filePath: string, extension?: string): PathSegment {
override basename(filePath: string, extension?: string): PathSegment {
return p.win32.basename(filePath, extension) as PathSegment;
}
isRooted(path: string): boolean {
override isRooted(path: string): boolean {
return /^([A-Z]:)?([\\\/]|$)/i.test(path);
}
protected splitPath<T extends PathString>(path: T): string[] {
protected override splitPath<T extends PathString>(path: T): string[] {
return path.split(/[\\\/]/);
}
normalize<T extends PathString>(path: T): T {
override normalize<T extends PathString>(path: T): T {
return path.replace(/^[\/\\]/i, 'C:/').replace(/\\/g, '/') as T;
}
}

View File

@ -35,11 +35,11 @@ export interface SemanticDependencyResult {
* compilation.
*/
class OpaqueSymbol extends SemanticSymbol {
isPublicApiAffected(): false {
override isPublicApiAffected(): false {
return false;
}
isTypeCheckApiAffected(): false {
override isTypeCheckApiAffected(): false {
return false;
}
}

View File

@ -16,7 +16,7 @@ export class ArraySliceBuiltinFn extends KnownFn {
super();
}
evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
override evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
if (args.length === 0) {
return this.lhs;
} else {
@ -30,7 +30,7 @@ export class ArrayConcatBuiltinFn extends KnownFn {
super();
}
evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
override evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
const result: ResolvedValueArray = [...this.lhs];
for (const arg of args) {
if (arg instanceof DynamicValue) {
@ -46,7 +46,7 @@ export class ArrayConcatBuiltinFn extends KnownFn {
}
export class ObjectAssignBuiltinFn extends KnownFn {
evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
override evaluate(node: ts.CallExpression, args: ResolvedValueArray): ResolvedValue {
if (args.length === 0) {
return DynamicValue.fromUnsupportedSyntax(node);
}

View File

@ -19,7 +19,7 @@ export class AssignHelperFn extends ObjectAssignBuiltinFn {}
// Used for both `__spread()` and `__spreadArrays()` TypeScript helper functions.
export class SpreadHelperFn extends KnownFn {
evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValueArray {
override evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValueArray {
const result: ResolvedValueArray = [];
for (const arg of args) {
@ -38,7 +38,7 @@ export class SpreadHelperFn extends KnownFn {
// Used for `__spreadArray` TypeScript helper function.
export class SpreadArrayHelperFn extends KnownFn {
evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValue {
override evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValue {
if (args.length !== 2) {
return DynamicValue.fromUnknown(node);
}
@ -62,7 +62,7 @@ export class SpreadArrayHelperFn extends KnownFn {
// Used for `__read` TypeScript helper function.
export class ReadHelperFn extends KnownFn {
evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValue {
override evaluate(node: ts.Node, args: ResolvedValueArray): ResolvedValue {
if (args.length !== 1) {
// The `__read` helper accepts a second argument `n` but that case is not supported.
return DynamicValue.fromUnknown(node);

View File

@ -61,7 +61,7 @@ class IvyCompilationVisitor extends Visitor {
super();
}
visitClassDeclaration(node: ts.ClassDeclaration):
override visitClassDeclaration(node: ts.ClassDeclaration):
VisitListEntryResult<ts.Statement, ts.ClassDeclaration> {
// Determine if this class has an Ivy field that needs to be added, and compile the field
// to an expression if so.
@ -87,7 +87,7 @@ class IvyTransformationVisitor extends Visitor {
super();
}
visitClassDeclaration(node: ts.ClassDeclaration):
override visitClassDeclaration(node: ts.ClassDeclaration):
VisitListEntryResult<ts.Statement, ts.ClassDeclaration> {
// If this class is not registered in the map, it means that it doesn't have Angular decorators,
// thus no further processing is required.

View File

@ -192,14 +192,14 @@ class TcbElementOp extends TcbOp {
super();
}
get optional() {
override get optional() {
// The statement generated by this operation is only used for type-inference of the DOM
// element's type and won't report diagnostics by itself, so the operation is marked as optional
// to avoid generating statements for DOM elements that are never referenced.
return true;
}
execute(): ts.Identifier {
override execute(): ts.Identifier {
const id = this.tcb.allocateId();
// Add the declaration of the element using document.createElement.
const initializer = tsCreateElement(this.element.name);
@ -222,11 +222,11 @@ class TcbVariableOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): ts.Identifier {
override execute(): ts.Identifier {
// Look for a context variable for the template.
const ctx = this.scope.resolve(this.template);
@ -263,9 +263,9 @@ class TcbTemplateContextOp extends TcbOp {
}
// The declaration of the context variable is only needed when the context is actually referenced.
readonly optional = true;
override readonly optional = true;
execute(): ts.Identifier {
override execute(): ts.Identifier {
// Allocate a template ctx variable and declare it with an 'any' type. The type of this variable
// may be narrowed as a result of template guard conditions.
const ctx = this.tcb.allocateId();
@ -287,11 +287,11 @@ class TcbTemplateBodyOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
// An `if` will be constructed, within which the template's children will be type checked. The
// `if` is used for two reasons: it creates a new syntactic scope, isolating variables declared
// in the template's TCB from the outer context, and it allows any directives on the templates
@ -414,11 +414,11 @@ class TcbTextInterpolationOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
this.scope.addStatement(ts.createExpressionStatement(expr));
return null;
@ -436,14 +436,14 @@ abstract class TcbDirectiveTypeOpBase extends TcbOp {
super();
}
get optional() {
override get optional() {
// The statement generated by this operation is only used to declare the directive's type and
// won't report diagnostics by itself, so the operation is marked as optional to avoid
// generating declarations for directives that don't have any inputs/outputs.
return true;
}
execute(): ts.Identifier {
override execute(): ts.Identifier {
const dirRef = this.dir.ref as Reference<ClassDeclaration<ts.ClassDeclaration>>;
const rawType = this.tcb.env.referenceType(this.dir.ref);
@ -543,9 +543,9 @@ class TcbReferenceOp extends TcbOp {
// The statement generated by this operation is only used to for the Type Checker
// so it can map a reference variable in the template directly to a node in the TCB.
readonly optional = true;
override readonly optional = true;
execute(): ts.Identifier {
override execute(): ts.Identifier {
const id = this.tcb.allocateId();
let initializer =
this.target instanceof TmplAstTemplate || this.target instanceof TmplAstElement ?
@ -591,9 +591,9 @@ class TcbInvalidReferenceOp extends TcbOp {
}
// The declaration of a missing reference is only needed when the reference is resolved.
readonly optional = true;
override readonly optional = true;
execute(): ts.Identifier {
override execute(): ts.Identifier {
const id = this.tcb.allocateId();
this.scope.addStatement(tsCreateVariable(id, NULL_AS_ANY));
return id;
@ -619,13 +619,13 @@ class TcbDirectiveCtorOp extends TcbOp {
super();
}
get optional() {
override get optional() {
// The statement generated by this operation is only used to infer the directive's type and
// won't report diagnostics by itself, so the operation is marked as optional.
return true;
}
execute(): ts.Identifier {
override execute(): ts.Identifier {
const id = this.tcb.allocateId();
addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
addParseSpanInfo(id, this.node.startSourceSpan || this.node.sourceSpan);
@ -689,11 +689,11 @@ class TcbDirectiveInputsOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
let dirId: ts.Expression|null = null;
// TODO(joost): report duplicate properties
@ -815,11 +815,11 @@ class TcbDirectiveCtorCircularFallbackOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): ts.Identifier {
override execute(): ts.Identifier {
const id = this.tcb.allocateId();
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
const circularPlaceholder = ts.createCall(
@ -846,11 +846,11 @@ class TcbDomSchemaCheckerOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): ts.Expression|null {
override execute(): ts.Expression|null {
if (this.checkElement) {
this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.element, this.tcb.schemas);
}
@ -906,11 +906,11 @@ class TcbUnclaimedInputsOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
// `this.inputs` contains only those bindings not matched by any directive. These bindings go to
// the element itself.
let elId: ts.Expression|null = null;
@ -972,11 +972,11 @@ export class TcbDirectiveOutputsOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
let dirId: ts.Expression|null = null;
const outputs = this.dir.outputs;
@ -1035,11 +1035,11 @@ class TcbUnclaimedOutputsOp extends TcbOp {
super();
}
get optional() {
override get optional() {
return false;
}
execute(): null {
override execute(): null {
let elId: ts.Expression|null = null;
// TODO(alxhub): this could be more efficient.
@ -1103,9 +1103,9 @@ class TcbComponentContextCompletionOp extends TcbOp {
super();
}
readonly optional = false;
override readonly optional = false;
execute(): null {
override execute(): null {
const ctx = ts.createIdentifier('ctx');
const ctxDot = ts.createPropertyAccess(ctx, '');
markIgnoreDiagnostics(ctxDot);

View File

@ -13,7 +13,7 @@ import {makeProgram} from '../../testing';
import {visit, VisitListEntryResult, Visitor} from '../src/visitor';
class TestAstVisitor extends Visitor {
visitClassDeclaration(node: ts.ClassDeclaration):
override visitClassDeclaration(node: ts.ClassDeclaration):
VisitListEntryResult<ts.Statement, ts.ClassDeclaration> {
const name = node.name!.text;
const statics = node.members.filter(

View File

@ -1056,7 +1056,7 @@ class PopulatedScope extends BindingScope {
super();
}
resolve(name: string): any {
override resolve(name: string): any {
return this.bindings.has(name) ? this.bindings.get(name) : BindingScope.missing;
}
}

View File

@ -62,7 +62,7 @@ class FixupExpression extends o.Expression {
this.original = resolved;
}
visitExpression(visitor: o.ExpressionVisitor, context: any): any {
override visitExpression(visitor: o.ExpressionVisitor, context: any): any {
if (context === KEY_CONTEXT) {
// When producing a key we want to traverse the constant not the
// variable used to refer to it.
@ -72,11 +72,11 @@ class FixupExpression extends o.Expression {
}
}
isEquivalent(e: o.Expression): boolean {
override isEquivalent(e: o.Expression): boolean {
return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);
}
isConstant() {
override isConstant() {
return true;
}

View File

@ -65,7 +65,7 @@ export class Quote extends AST {
public uninterpretedExpression: string, public location: any) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitQuote(this, context);
}
override toString(): string {
@ -74,13 +74,13 @@ export class Quote extends AST {
}
export class EmptyExpr extends AST {
visit(visitor: AstVisitor, context: any = null) {
override visit(visitor: AstVisitor, context: any = null) {
// do nothing
}
}
export class ImplicitReceiver extends AST {
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitImplicitReceiver(this, context);
}
}
@ -106,7 +106,7 @@ export class Chain extends AST {
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public expressions: any[]) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitChain(this, context);
}
}
@ -117,7 +117,7 @@ export class Conditional extends AST {
public falseExp: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitConditional(this, context);
}
}
@ -128,7 +128,7 @@ export class PropertyRead extends ASTWithName {
public receiver: AST, public name: string) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitPropertyRead(this, context);
}
}
@ -139,7 +139,7 @@ export class PropertyWrite extends ASTWithName {
public receiver: AST, public name: string, public value: AST) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitPropertyWrite(this, context);
}
}
@ -150,7 +150,7 @@ export class SafePropertyRead extends ASTWithName {
public receiver: AST, public name: string) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitSafePropertyRead(this, context);
}
}
@ -160,7 +160,7 @@ export class KeyedRead extends AST {
span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public receiver: AST, public key: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitKeyedRead(this, context);
}
}
@ -170,7 +170,7 @@ export class SafeKeyedRead extends AST {
span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public receiver: AST, public key: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitSafeKeyedRead(this, context);
}
}
@ -181,7 +181,7 @@ export class KeyedWrite extends AST {
public value: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitKeyedWrite(this, context);
}
}
@ -192,7 +192,7 @@ export class BindingPipe extends ASTWithName {
public args: any[], nameSpan: AbsoluteSourceSpan) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitPipe(this, context);
}
}
@ -201,7 +201,7 @@ export class LiteralPrimitive extends AST {
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public value: any) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitLiteralPrimitive(this, context);
}
}
@ -210,7 +210,7 @@ export class LiteralArray extends AST {
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public expressions: any[]) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitLiteralArray(this, context);
}
}
@ -225,7 +225,7 @@ export class LiteralMap extends AST {
public values: any[]) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitLiteralMap(this, context);
}
}
@ -236,7 +236,7 @@ export class Interpolation extends AST {
public expressions: any[]) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitInterpolation(this, context);
}
}
@ -247,7 +247,7 @@ export class Binary extends AST {
public right: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitBinary(this, context);
}
}
@ -302,7 +302,7 @@ export class PrefixNot extends AST {
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public expression: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitPrefixNot(this, context);
}
}
@ -311,7 +311,7 @@ export class NonNullAssert extends AST {
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, public expression: AST) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitNonNullAssert(this, context);
}
}
@ -323,7 +323,7 @@ export class MethodCall extends ASTWithName {
public argumentSpan: AbsoluteSourceSpan) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitMethodCall(this, context);
}
}
@ -335,7 +335,7 @@ export class SafeMethodCall extends ASTWithName {
public argumentSpan: AbsoluteSourceSpan) {
super(span, sourceSpan, nameSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitSafeMethodCall(this, context);
}
}
@ -346,7 +346,7 @@ export class FunctionCall extends AST {
public args: any[]) {
super(span, sourceSpan);
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
return visitor.visitFunctionCall(this, context);
}
}
@ -368,7 +368,7 @@ export class ASTWithSource extends AST {
new AbsoluteSourceSpan(
absoluteOffset, source === null ? absoluteOffset : absoluteOffset + source.length));
}
visit(visitor: AstVisitor, context: any = null): any {
override visit(visitor: AstVisitor, context: any = null): any {
if (visitor.visitASTWithSource) {
return visitor.visitASTWithSource(this, context);
}

View File

@ -34,7 +34,7 @@ const _CONTEXT_TAG = 'context';
// https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
// https://docs.oasis-open.org/xliff/v1.2/xliff-profile-html/xliff-profile-html-1.2.html
export class Xliff extends Serializer {
write(messages: i18n.Message[], locale: string|null): string {
override write(messages: i18n.Message[], locale: string|null): string {
const visitor = new _WriteVisitor();
const transUnits: xml.Node[] = [];
@ -92,7 +92,7 @@ export class Xliff extends Serializer {
]);
}
load(content: string, url: string):
override load(content: string, url: string):
{locale: string, i18nNodesByMsgId: {[msgId: string]: i18n.Node[]}} {
// xliff to xml nodes
const xliffParser = new XliffParser();
@ -115,7 +115,7 @@ export class Xliff extends Serializer {
return {locale: locale!, i18nNodesByMsgId};
}
digest(message: i18n.Message): string {
override digest(message: i18n.Message): string {
return digest(message);
}
}

View File

@ -30,7 +30,7 @@ const _UNIT_TAG = 'unit';
// https://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html
export class Xliff2 extends Serializer {
write(messages: i18n.Message[], locale: string|null): string {
override write(messages: i18n.Message[], locale: string|null): string {
const visitor = new _WriteVisitor();
const units: xml.Node[] = [];
@ -85,7 +85,7 @@ export class Xliff2 extends Serializer {
]);
}
load(content: string, url: string):
override load(content: string, url: string):
{locale: string, i18nNodesByMsgId: {[msgId: string]: i18n.Node[]}} {
// xliff to xml nodes
const xliff2Parser = new Xliff2Parser();
@ -108,7 +108,7 @@ export class Xliff2 extends Serializer {
return {locale: locale!, i18nNodesByMsgId};
}
digest(message: i18n.Message): string {
override digest(message: i18n.Message): string {
return decimalDigest(message);
}
}

View File

@ -39,7 +39,7 @@ const _DOCTYPE = `<!ELEMENT messagebundle (msg)*>
<!ELEMENT ex (#PCDATA)>`;
export class Xmb extends Serializer {
write(messages: i18n.Message[], locale: string|null): string {
override write(messages: i18n.Message[], locale: string|null): string {
const exampleVisitor = new ExampleVisitor();
const visitor = new _Visitor();
let rootNode = new xml.Tag(_MESSAGES_TAG);
@ -80,12 +80,12 @@ export class Xmb extends Serializer {
]);
}
load(content: string, url: string):
override load(content: string, url: string):
{locale: string, i18nNodesByMsgId: {[msgId: string]: i18n.Node[]}} {
throw new Error('Unsupported');
}
digest(message: i18n.Message): string {
override digest(message: i18n.Message): string {
return digest(message);
}

View File

@ -19,11 +19,11 @@ const _TRANSLATION_TAG = 'translation';
const _PLACEHOLDER_TAG = 'ph';
export class Xtb extends Serializer {
write(messages: i18n.Message[], locale: string|null): string {
override write(messages: i18n.Message[], locale: string|null): string {
throw new Error('Unsupported');
}
load(content: string, url: string):
override load(content: string, url: string):
{locale: string, i18nNodesByMsgId: {[msgId: string]: i18n.Node[]}} {
// xtb to xml nodes
const xtbParser = new XtbParser();
@ -54,7 +54,7 @@ export class Xtb extends Serializer {
return {locale: locale!, i18nNodesByMsgId};
}
digest(message: i18n.Message): string {
override digest(message: i18n.Message): string {
return digest(message);
}

View File

@ -26,7 +26,7 @@ export class Text extends NodeWithI18n {
constructor(public value: string, sourceSpan: ParseSourceSpan, i18n?: I18nMeta) {
super(sourceSpan, i18n);
}
visit(visitor: Visitor, context: any): any {
override visit(visitor: Visitor, context: any): any {
return visitor.visitText(this, context);
}
}
@ -37,7 +37,7 @@ export class Expansion extends NodeWithI18n {
sourceSpan: ParseSourceSpan, public switchValueSourceSpan: ParseSourceSpan, i18n?: I18nMeta) {
super(sourceSpan, i18n);
}
visit(visitor: Visitor, context: any): any {
override visit(visitor: Visitor, context: any): any {
return visitor.visitExpansion(this, context);
}
}
@ -59,7 +59,7 @@ export class Attribute extends NodeWithI18n {
i18n?: I18nMeta) {
super(sourceSpan, i18n);
}
visit(visitor: Visitor, context: any): any {
override visit(visitor: Visitor, context: any): any {
return visitor.visitAttribute(this, context);
}
}
@ -71,7 +71,7 @@ export class Element extends NodeWithI18n {
public endSourceSpan: ParseSourceSpan|null = null, i18n?: I18nMeta) {
super(sourceSpan, i18n);
}
visit(visitor: Visitor, context: any): any {
override visit(visitor: Visitor, context: any): any {
return visitor.visitElement(this, context);
}
}

View File

@ -29,7 +29,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
constructor() {
super(false);
}
visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
override visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
ctx.pushClass(stmt);
this._visitClassConstructor(stmt, ctx);
@ -102,7 +102,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
}
return null;
}
visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
override visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
ctx.print(stmt, `var ${stmt.name}`);
if (stmt.value) {
ctx.print(stmt, ' = ');
@ -111,7 +111,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
ctx.println(stmt, `;`);
return null;
}
visitCastExpr(ast: o.CastExpr, ctx: EmitterVisitorContext): any {
override visitCastExpr(ast: o.CastExpr, ctx: EmitterVisitorContext): any {
ast.value.visitExpression(this, ctx);
return null;
}
@ -152,7 +152,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
ctx.print(ast, ')');
return null;
}
visitFunctionExpr(ast: o.FunctionExpr, ctx: EmitterVisitorContext): any {
override visitFunctionExpr(ast: o.FunctionExpr, ctx: EmitterVisitorContext): any {
ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);
this._visitParams(ast.params, ctx);
ctx.println(ast, `) {`);
@ -162,7 +162,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
ctx.print(ast, `}`);
return null;
}
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
override visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
ctx.print(stmt, `function ${stmt.name}(`);
this._visitParams(stmt.params, ctx);
ctx.println(stmt, `) {`);
@ -172,7 +172,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
ctx.println(stmt, `}`);
return null;
}
visitTryCatchStmt(stmt: o.TryCatchStmt, ctx: EmitterVisitorContext): any {
override visitTryCatchStmt(stmt: o.TryCatchStmt, ctx: EmitterVisitorContext): any {
ctx.println(stmt, `try {`);
ctx.incIndent();
this.visitAllStatements(stmt.bodyStmts, ctx);
@ -217,7 +217,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');
}
getBuiltinMethodName(method: o.BuiltinMethod): string {
override getBuiltinMethodName(method: o.BuiltinMethod): string {
let name: string;
switch (method) {
case o.BuiltinMethod.ConcatArray:

View File

@ -41,7 +41,7 @@ export class JavaScriptEmitter implements OutputEmitter {
class JsEmitterVisitor extends AbstractJsEmitterVisitor {
importsWithPrefixes = new Map<string, string>();
visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
override visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
const {name, moduleName} = ast.value;
if (moduleName) {
let prefix = this.importsWithPrefixes.get(moduleName);

View File

@ -39,7 +39,7 @@ export class BuiltinType extends Type {
constructor(public name: BuiltinTypeName, modifiers?: TypeModifier[]) {
super(modifiers);
}
visitType(visitor: TypeVisitor, context: any): any {
override visitType(visitor: TypeVisitor, context: any): any {
return visitor.visitBuiltinType(this, context);
}
}
@ -49,7 +49,7 @@ export class ExpressionType extends Type {
public value: Expression, modifiers?: TypeModifier[], public typeParams: Type[]|null = null) {
super(modifiers);
}
visitType(visitor: TypeVisitor, context: any): any {
override visitType(visitor: TypeVisitor, context: any): any {
return visitor.visitExpressionType(this, context);
}
}
@ -59,7 +59,7 @@ export class ArrayType extends Type {
constructor(public of: Type, modifiers?: TypeModifier[]) {
super(modifiers);
}
visitType(visitor: TypeVisitor, context: any): any {
override visitType(visitor: TypeVisitor, context: any): any {
return visitor.visitArrayType(this, context);
}
}
@ -71,7 +71,7 @@ export class MapType extends Type {
super(modifiers);
this.valueType = valueType || null;
}
visitType(visitor: TypeVisitor, context: any): any {
override visitType(visitor: TypeVisitor, context: any): any {
return visitor.visitMapType(this, context);
}
}
@ -286,15 +286,15 @@ export class ReadVarExpr extends Expression {
}
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitReadVarExpr(this, context);
}
@ -311,15 +311,15 @@ export class TypeofExpr extends Expression {
super(type, sourceSpan);
}
visitExpression(visitor: ExpressionVisitor, context: any) {
override visitExpression(visitor: ExpressionVisitor, context: any) {
return visitor.visitTypeofExpr(this, context);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof TypeofExpr && e.expr.isEquivalent(this.expr);
}
isConstant(): boolean {
override isConstant(): boolean {
return this.expr.isConstant();
}
}
@ -329,15 +329,15 @@ export class WrappedNodeExpr<T> extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof WrappedNodeExpr && this.node === e.node;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitWrappedNodeExpr(this, context);
}
}
@ -350,15 +350,15 @@ export class WriteVarExpr extends Expression {
this.value = value;
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitWriteVarExpr(this, context);
}
@ -381,16 +381,16 @@ export class WriteKeyExpr extends Expression {
this.value = value;
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) &&
this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitWriteKeyExpr(this, context);
}
}
@ -405,16 +405,16 @@ export class WritePropExpr extends Expression {
this.value = value;
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name && this.value.isEquivalent(e.value);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitWritePropExpr(this, context);
}
}
@ -441,16 +441,16 @@ export class InvokeMethodExpr extends Expression {
}
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitInvokeMethodExpr(this, context);
}
}
@ -463,16 +463,16 @@ export class InvokeFunctionExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
areAllEquivalent(this.args, e.args) && this.pure === e.pure;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitInvokeFunctionExpr(this, context);
}
}
@ -485,18 +485,18 @@ export class TaggedTemplateExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof TaggedTemplateExpr && this.tag.isEquivalent(e.tag) &&
areAllEquivalentPredicate(
this.template.elements, e.template.elements, (a, b) => a.text === b.text) &&
areAllEquivalent(this.template.expressions, e.template.expressions);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitTaggedTemplateExpr(this, context);
}
}
@ -509,16 +509,16 @@ export class InstantiateExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) &&
areAllEquivalent(this.args, e.args);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitInstantiateExpr(this, context);
}
}
@ -531,15 +531,15 @@ export class LiteralExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof LiteralExpr && this.value === e.value;
}
isConstant() {
override isConstant() {
return true;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitLiteralExpr(this, context);
}
}
@ -575,16 +575,16 @@ export class LocalizedString extends Expression {
super(STRING_TYPE, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
// return e instanceof LocalizedString && this.message === e.message;
return false;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitLocalizedString(this, context);
}
@ -696,16 +696,16 @@ export class ExternalExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof ExternalExpr && this.value.name === e.value.name &&
this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitExternalExpr(this, context);
}
}
@ -726,16 +726,16 @@ export class ConditionalExpr extends Expression {
this.trueCase = trueCase;
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) &&
this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitConditionalExpr(this, context);
}
}
@ -746,15 +746,15 @@ export class NotExpr extends Expression {
super(BOOL_TYPE, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof NotExpr && this.condition.isEquivalent(e.condition);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitNotExpr(this, context);
}
}
@ -764,15 +764,15 @@ export class AssertNotNull extends Expression {
super(condition.type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitAssertNotNullExpr(this, context);
}
}
@ -782,15 +782,15 @@ export class CastExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof CastExpr && this.value.isEquivalent(e.value);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitCastExpr(this, context);
}
}
@ -812,16 +812,16 @@ export class FunctionExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) &&
areAllEquivalent(this.statements, e.statements);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitFunctionExpr(this, context);
}
@ -839,16 +839,16 @@ export class UnaryOperatorExpr extends Expression {
super(type || NUMBER_TYPE, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof UnaryOperatorExpr && this.operator === e.operator &&
this.expr.isEquivalent(e.expr);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitUnaryOperatorExpr(this, context);
}
}
@ -863,16 +863,16 @@ export class BinaryOperatorExpr extends Expression {
this.lhs = lhs;
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof BinaryOperatorExpr && this.operator === e.operator &&
this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitBinaryOperatorExpr(this, context);
}
}
@ -885,16 +885,16 @@ export class ReadPropExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name;
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitReadPropExpr(this, context);
}
@ -911,16 +911,16 @@ export class ReadKeyExpr extends Expression {
super(type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) &&
this.index.isEquivalent(e.index);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitReadKeyExpr(this, context);
}
@ -937,14 +937,14 @@ export class LiteralArrayExpr extends Expression {
this.entries = entries;
}
isConstant() {
override isConstant() {
return this.entries.every(e => e.isConstant());
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitLiteralArrayExpr(this, context);
}
}
@ -966,15 +966,15 @@ export class LiteralMapExpr extends Expression {
}
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
}
isConstant() {
override isConstant() {
return this.entries.every(e => e.value.isConstant());
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitLiteralMapExpr(this, context);
}
}
@ -984,15 +984,15 @@ export class CommaExpr extends Expression {
super(parts[parts.length - 1].type, sourceSpan);
}
isEquivalent(e: Expression): boolean {
override isEquivalent(e: Expression): boolean {
return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
}
isConstant() {
override isConstant() {
return false;
}
visitExpression(visitor: ExpressionVisitor, context: any): any {
override visitExpression(visitor: ExpressionVisitor, context: any): any {
return visitor.visitCommaExpr(this, context);
}
}
@ -1086,11 +1086,11 @@ export class DeclareVarStmt extends Statement {
super(modifiers, sourceSpan, leadingComments);
this.type = type || (value && value.type) || null;
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof DeclareVarStmt && this.name === stmt.name &&
(this.value ? !!stmt.value && this.value.isEquivalent(stmt.value) : !stmt.value);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitDeclareVarStmt(this, context);
}
}
@ -1104,11 +1104,11 @@ export class DeclareFunctionStmt extends Statement {
super(modifiers, sourceSpan, leadingComments);
this.type = type || null;
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) &&
areAllEquivalent(this.statements, stmt.statements);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitDeclareFunctionStmt(this, context);
}
}
@ -1119,10 +1119,10 @@ export class ExpressionStatement extends Statement {
leadingComments?: LeadingComment[]) {
super([], sourceSpan, leadingComments);
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitExpressionStmt(this, context);
}
}
@ -1134,10 +1134,10 @@ export class ReturnStatement extends Statement {
leadingComments?: LeadingComment[]) {
super([], sourceSpan, leadingComments);
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitReturnStmt(this, context);
}
}
@ -1192,7 +1192,7 @@ export class ClassStmt extends Statement {
leadingComments?: LeadingComment[]) {
super(modifiers, sourceSpan, leadingComments);
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof ClassStmt && this.name === stmt.name &&
nullSafeIsEquivalent(this.parent, stmt.parent) &&
areAllEquivalent(this.fields, stmt.fields) &&
@ -1200,7 +1200,7 @@ export class ClassStmt extends Statement {
this.constructorMethod.isEquivalent(stmt.constructorMethod) &&
areAllEquivalent(this.methods, stmt.methods);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitDeclareClassStmt(this, context);
}
}
@ -1213,12 +1213,12 @@ export class IfStmt extends Statement {
leadingComments?: LeadingComment[]) {
super([], sourceSpan, leadingComments);
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) &&
areAllEquivalent(this.trueCase, stmt.trueCase) &&
areAllEquivalent(this.falseCase, stmt.falseCase);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitIfStmt(this, context);
}
}
@ -1229,11 +1229,11 @@ export class TryCatchStmt extends Statement {
sourceSpan: ParseSourceSpan|null = null, leadingComments?: LeadingComment[]) {
super([], sourceSpan, leadingComments);
}
isEquivalent(stmt: Statement): boolean {
override isEquivalent(stmt: Statement): boolean {
return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) &&
areAllEquivalent(this.catchStmts, stmt.catchStmts);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitTryCatchStmt(this, context);
}
}
@ -1245,10 +1245,10 @@ export class ThrowStmt extends Statement {
leadingComments?: LeadingComment[]) {
super([], sourceSpan, leadingComments);
}
isEquivalent(stmt: ThrowStmt): boolean {
override isEquivalent(stmt: ThrowStmt): boolean {
return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error);
}
visitStatement(visitor: StatementVisitor, context: any): any {
override visitStatement(visitor: StatementVisitor, context: any): any {
return visitor.visitThrowStmt(this, context);
}
}

View File

@ -119,7 +119,7 @@ export class JitEmitterVisitor extends AbstractJsEmitterVisitor {
return result;
}
visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
override visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
this._emitReferenceToExternal(ast, this.reflector.resolveExternalReference(ast.value), ctx);
return null;
}

View File

@ -118,7 +118,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return result;
}
visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
override visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
this._visitIdentifier(ast.value, ast.typeParams, ctx);
return null;
}
@ -129,7 +129,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return result;
}
visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
override visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
if (stmt.hasModifier(o.StmtModifier.Exported) && stmt.value instanceof o.ExternalExpr &&
!stmt.type) {
// check for a reexport
@ -166,7 +166,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
throw new Error('Cannot visit a WrappedNodeExpr when outputting Typescript.');
}
visitCastExpr(ast: o.CastExpr, ctx: EmitterVisitorContext): any {
override visitCastExpr(ast: o.CastExpr, ctx: EmitterVisitorContext): any {
ctx.print(ast, `(<`);
ast.type!.visitType(this, ctx);
ctx.print(ast, `>`);
@ -186,7 +186,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return null;
}
visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
override visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
ctx.pushClass(stmt);
if (stmt.hasModifier(o.StmtModifier.Exported)) {
ctx.print(stmt, `export `);
@ -267,7 +267,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
ctx.println(null, `}`);
}
visitFunctionExpr(ast: o.FunctionExpr, ctx: EmitterVisitorContext): any {
override visitFunctionExpr(ast: o.FunctionExpr, ctx: EmitterVisitorContext): any {
if (ast.name) {
ctx.print(ast, 'function ');
ctx.print(ast, ast.name);
@ -288,7 +288,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return null;
}
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
override visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
if (stmt.hasModifier(o.StmtModifier.Exported)) {
ctx.print(stmt, `export `);
}
@ -304,7 +304,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return null;
}
visitTryCatchStmt(stmt: o.TryCatchStmt, ctx: EmitterVisitorContext): any {
override visitTryCatchStmt(stmt: o.TryCatchStmt, ctx: EmitterVisitorContext): any {
ctx.println(stmt, `try {`);
ctx.incIndent();
this.visitAllStatements(stmt.bodyStmts, ctx);
@ -375,7 +375,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
return null;
}
getBuiltinMethodName(method: o.BuiltinMethod): string {
override getBuiltinMethodName(method: o.BuiltinMethod): string {
let name: string;
switch (method) {
case o.BuiltinMethod.ConcatArray:

View File

@ -291,7 +291,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
});
}
hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean {
override hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean {
if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) {
return true;
}
@ -312,7 +312,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
return !!elementProperties[propName];
}
hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean {
override hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean {
if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) {
return true;
}
@ -341,7 +341,8 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
* above are assumed to have the 'NONE' security context, i.e. that they are safe inert
* string values. Only specific well known attack vectors are assigned their appropriate context.
*/
securityContext(tagName: string, propName: string, isAttribute: boolean): SecurityContext {
override securityContext(tagName: string, propName: string, isAttribute: boolean):
SecurityContext {
if (isAttribute) {
// NB: For security purposes, use the mapped property name, not the attribute name.
propName = this.getMappedPropName(propName);
@ -359,15 +360,15 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
return ctx ? ctx : SecurityContext.NONE;
}
getMappedPropName(propName: string): string {
override getMappedPropName(propName: string): string {
return _ATTR_TO_PROP[propName] || propName;
}
getDefaultComponentElementName(): string {
override getDefaultComponentElementName(): string {
return 'ng-component';
}
validateProperty(name: string): {error: boolean, msg?: string} {
override validateProperty(name: string): {error: boolean, msg?: string} {
if (name.toLowerCase().startsWith('on')) {
const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
`please use (${name.slice(2)})=...` +
@ -379,7 +380,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
}
}
validateAttribute(name: string): {error: boolean, msg?: string} {
override validateAttribute(name: string): {error: boolean, msg?: string} {
if (name.toLowerCase().startsWith('on')) {
const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
`please use (${name.slice(2)})=...`;
@ -389,7 +390,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
}
}
allKnownElementNames(): string[] {
override allKnownElementNames(): string[] {
return Object.keys(this._schema);
}
@ -399,12 +400,13 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
return Object.keys(elementProperties).map(prop => _PROP_TO_ATTR[prop] ?? prop);
}
normalizeAnimationStyleProperty(propName: string): string {
override normalizeAnimationStyleProperty(propName: string): string {
return dashCaseToCamelCase(propName);
}
normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string|number):
{error: string, value: string} {
override normalizeAnimationStyleValue(
camelCaseProp: string, userProvidedProp: string,
val: string|number): {error: string, value: string} {
let unit: string = '';
const strVal = val.toString().trim();
let errorMsg: string = null!;

View File

@ -44,17 +44,17 @@ import {DEFAULT_INTERPOLATION_CONFIG} from '../../src/ml_parser/interpolation_co
}
class _TestSerializer extends Serializer {
write(messages: i18n.Message[]): string {
override write(messages: i18n.Message[]): string {
return messages.map(msg => `${serializeNodes(msg.nodes)} (${msg.meaning}|${msg.description})`)
.join('//');
}
load(content: string, url: string):
override load(content: string, url: string):
{locale: string|null, i18nNodesByMsgId: {[id: string]: i18n.Node[]}} {
return {locale: null, i18nNodesByMsgId: {}};
}
digest(msg: i18n.Message): string {
override digest(msg: i18n.Message): string {
return msg.id || `default`;
}
}

View File

@ -17,7 +17,7 @@ export class MockResourceLoader extends ResourceLoader {
private _definitions = new Map<string, string>();
private _requests: _PendingRequest[] = [];
get(url: string): Promise<string> {
override get(url: string): Promise<string> {
const request = new _PendingRequest(url);
this._requests.push(request);
return request.getPromise();

View File

@ -12,7 +12,7 @@ import * as ts from 'typescript';
import {findFragmentAccesses, migrateActivatedRouteSnapshotFragment} from '../activated-route-snapshot-fragment/util';
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
if (sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
return [];
}

View File

@ -13,7 +13,7 @@ import {findLiteralsToMigrate, migrateLiteral} from '../can-activate-with-redire
/** TSLint rule that removes canActivate from Route configs that also have redirectTo. */
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const failures: RuleFailure[] = [];
const printer = ts.createPrinter();
const literalsToMigrate = findLiteralsToMigrate(sourceFile);

View File

@ -19,7 +19,7 @@ const FAILURE_MESSAGE =
* TSLint rule that removes the `static` flag from dynamic queries.
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const printer = ts.createPrinter();
const failures: RuleFailure[] = [];
const result = identifyDynamicQueryNodes(program.getTypeChecker(), sourceFile);

View File

@ -24,7 +24,7 @@ const FAILURE_MESSAGE = 'Query does not explicitly specify its timing. Read more
* be applied in order to automatically migrate to the explicit query timing API.
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const queryVisitor = new NgQueryResolveVisitor(program.getTypeChecker());
const templateVisitor = new NgComponentTemplateVisitor(typeChecker);

View File

@ -19,7 +19,7 @@ import {InitialNavigationTransform} from '../initial-navigation/transform';
* TSLint rule that updates RouterModule `forRoot` options to be in line with v10 updates.
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const ruleName = this.ruleName;
const typeChecker = program.getTypeChecker();
const sourceFiles = program.getSourceFiles().filter(

View File

@ -13,7 +13,7 @@ import {findLiteralsToMigrate, migrateLiteral} from '../../migrations/navigation
/** TSLint rule that migrates `navigateByUrl` and `createUrlTree` calls to an updated signature. */
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const failures: RuleFailure[] = [];
const typeChecker = program.getTypeChecker();
const printer = ts.createPrinter();

View File

@ -21,7 +21,7 @@ import {MissingInjectableTransform} from '../missing-injectable/transform';
* Angular decorator (e.g. "@Injectable").
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const ruleName = this.ruleName;
const typeChecker = program.getTypeChecker();
const sourceFiles = program.getSourceFiles().filter(

View File

@ -20,7 +20,7 @@ const FAILURE_MESSAGE = 'Found assignment to template variable. This does not wo
* Rule that reports if an Angular template contains property assignments to template variables.
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const templateVisitor = new NgComponentTemplateVisitor(typeChecker);
const failures: RuleFailure[] = [];

View File

@ -14,7 +14,7 @@ import {TslintUpdateRecorder} from '../relative-link-resolution/google3/tslint_u
import {RelativeLinkResolutionTransform} from '../relative-link-resolution/transform';
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const ruleName = this.ruleName;
const sourceFiles = program.getSourceFiles().filter(

View File

@ -20,7 +20,7 @@ import {findRendererReferences} from '../renderer-to-renderer2/util';
* https://hackmd.angular.io/UTzUZTnPRA-cSa_4mHyfYw
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const printer = ts.createPrinter();
const failures: RuleFailure[] = [];

View File

@ -16,7 +16,7 @@ import {UndecoratedClassesWithDecoratedFieldsTransform} from '../undecorated-cla
* https://hackmd.io/vuQfavzfRG6KUCtU7oK_EA
*/
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const ruleName = this.ruleName;
const sourceFiles = program.getSourceFiles().filter(

View File

@ -21,7 +21,7 @@ const newFunction = 'waitForAsync';
/** TSLint rule that migrates from `async` to `waitForAsync`. */
export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
override applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const failures: RuleFailure[] = [];
const asyncImportSpecifier =
getImportSpecifier(sourceFile, '@angular/core/testing', deprecatedFunction);

View File

@ -79,11 +79,11 @@ export class CodegenComponentFactoryResolver implements ComponentFactoryResolver
}
export class ComponentFactoryBoundToModule<C> extends ComponentFactory<C> {
readonly selector: string;
readonly componentType: Type<any>;
readonly ngContentSelectors: string[];
readonly inputs: {propName: string, templateName: string}[];
readonly outputs: {propName: string, templateName: string}[];
override readonly selector: string;
override readonly componentType: Type<any>;
override readonly ngContentSelectors: string[];
override readonly inputs: {propName: string, templateName: string}[];
override readonly outputs: {propName: string, templateName: string}[];
constructor(private factory: ComponentFactory<C>, private ngModule: NgModuleRef<any>) {
super();
@ -94,7 +94,7 @@ export class ComponentFactoryBoundToModule<C> extends ComponentFactory<C> {
this.outputs = factory.outputs;
}
create(
override create(
injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any,
ngModule?: NgModuleRef<any>): ComponentRef<C> {
return this.factory.create(

View File

@ -81,7 +81,7 @@ const R3TemplateRef = class TemplateRef<T> extends ViewEngineTemplateRef<T> {
super();
}
createEmbeddedView(context: T): EmbeddedViewRef<T> {
override createEmbeddedView(context: T): EmbeddedViewRef<T> {
const embeddedTView = this._declarationTContainer.tViews as TView;
const embeddedLView = createLView(
this._declarationLView, embeddedTView, context, LViewFlags.CheckAlways, null,

View File

@ -194,16 +194,16 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
super();
}
get element(): ElementRef {
override get element(): ElementRef {
return createElementRef(this._hostTNode, this._hostLView);
}
get injector(): Injector {
override get injector(): Injector {
return new NodeInjector(this._hostTNode, this._hostLView);
}
/** @deprecated No replacement */
get parentInjector(): Injector {
override get parentInjector(): Injector {
const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView);
if (hasParentInjector(parentLocation)) {
const parentView = getParentInjectorView(parentLocation, this._hostLView);
@ -217,29 +217,29 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
}
}
clear(): void {
override clear(): void {
while (this.length > 0) {
this.remove(this.length - 1);
}
}
get(index: number): ViewRef|null {
override get(index: number): ViewRef|null {
const viewRefs = getViewRefs(this._lContainer);
return viewRefs !== null && viewRefs[index] || null;
}
get length(): number {
override get length(): number {
return this._lContainer.length - CONTAINER_HEADER_OFFSET;
}
createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number):
override createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number):
EmbeddedViewRef<C> {
const viewRef = templateRef.createEmbeddedView(context || <any>{});
this.insert(viewRef, index);
return viewRef;
}
createComponent<C>(
override createComponent<C>(
componentFactory: ComponentFactory<C>, index?: number|undefined,
injector?: Injector|undefined, projectableNodes?: any[][]|undefined,
ngModuleRef?: NgModuleRef<any>|undefined): ComponentRef<C> {
@ -260,7 +260,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
return componentRef;
}
insert(viewRef: ViewRef, index?: number): ViewRef {
override insert(viewRef: ViewRef, index?: number): ViewRef {
const lView = (viewRef as R3ViewRef<any>)._lView!;
const tView = lView[TVIEW];
@ -315,19 +315,19 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
return viewRef;
}
move(viewRef: ViewRef, newIndex: number): ViewRef {
override move(viewRef: ViewRef, newIndex: number): ViewRef {
if (ngDevMode && viewRef.destroyed) {
throw new Error('Cannot move a destroyed View in a ViewContainer!');
}
return this.insert(viewRef, newIndex);
}
indexOf(viewRef: ViewRef): number {
override indexOf(viewRef: ViewRef): number {
const viewRefsArr = getViewRefs(this._lContainer);
return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1;
}
remove(index?: number): void {
override remove(index?: number): void {
const adjustedIdx = this._adjustIndex(index, -1);
const detachedView = detachView(this._lContainer, adjustedIdx);
@ -343,7 +343,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
}
}
detach(index?: number): ViewRef|null {
override detach(index?: number): ViewRef|null {
const adjustedIdx = this._adjustIndex(index, -1);
const view = detachView(this._lContainer, adjustedIdx);

View File

@ -47,7 +47,7 @@ export class ComponentFactoryResolver extends viewEngine_ComponentFactoryResolve
super();
}
resolveComponentFactory<T>(component: Type<T>): viewEngine_ComponentFactory<T> {
override resolveComponentFactory<T>(component: Type<T>): viewEngine_ComponentFactory<T> {
ngDevMode && assertComponentType(component);
const componentDef = getComponentDef(component)!;
return new ComponentFactory(componentDef, this.ngModule);
@ -103,16 +103,16 @@ function createChainedInjector(rootViewInjector: Injector, moduleInjector: Injec
* Render3 implementation of {@link viewEngine_ComponentFactory}.
*/
export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
selector: string;
componentType: Type<any>;
ngContentSelectors: string[];
override selector: string;
override componentType: Type<any>;
override ngContentSelectors: string[];
isBoundToModule: boolean;
get inputs(): {propName: string; templateName: string;}[] {
override get inputs(): {propName: string; templateName: string;}[] {
return toRefArray(this.componentDef.inputs);
}
get outputs(): {propName: string; templateName: string;}[] {
override get outputs(): {propName: string; templateName: string;}[] {
return toRefArray(this.componentDef.outputs);
}
@ -130,7 +130,7 @@ export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
this.isBoundToModule = !!ngModule;
}
create(
override create(
injector: Injector, projectableNodes?: any[][]|undefined, rootSelectorOrNode?: any,
ngModule?: viewEngine_NgModuleRef<any>|undefined): viewEngine_ComponentRef<T> {
ngModule = ngModule || this.ngModule;
@ -247,10 +247,10 @@ export function injectComponentFactoryResolver(): viewEngine_ComponentFactoryRes
*
*/
export class ComponentRef<T> extends viewEngine_ComponentRef<T> {
instance: T;
hostView: ViewRef<T>;
changeDetectorRef: ViewEngine_ChangeDetectorRef;
componentType: Type<T>;
override instance: T;
override hostView: ViewRef<T>;
override changeDetectorRef: ViewEngine_ChangeDetectorRef;
override componentType: Type<T>;
constructor(
componentType: Type<T>, instance: T, public location: viewEngine_ElementRef,
@ -262,15 +262,15 @@ export class ComponentRef<T> extends viewEngine_ComponentRef<T> {
this.componentType = componentType;
}
get injector(): Injector {
override get injector(): Injector {
return new NodeInjector(this._tNode, this._rootLView);
}
destroy(): void {
override destroy(): void {
this.hostView.destroy();
}
onDestroy(callback: () => void): void {
override onDestroy(callback: () => void): void {
this.hostView.onDestroy(callback);
}
}

View File

@ -28,8 +28,8 @@ export class NgModuleRef<T> extends viewEngine_NgModuleRef<T> implements Interna
_bootstrapComponents: Type<any>[] = [];
// tslint:disable-next-line:require-internal-with-underscore
_r3Injector: R3Injector;
injector: Injector = this;
instance: T;
override injector: Injector = this;
override instance: T;
destroyCbs: (() => void)[]|null = [];
// When bootstrapping a module we have a dependency graph that looks like this:
@ -38,7 +38,8 @@ export class NgModuleRef<T> extends viewEngine_NgModuleRef<T> implements Interna
// circular dependency which will result in a runtime error, because the injector doesn't
// exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
// and providing it, rather than letting the injector resolve it.
readonly componentFactoryResolver: ComponentFactoryResolver = new ComponentFactoryResolver(this);
override readonly componentFactoryResolver: ComponentFactoryResolver =
new ComponentFactoryResolver(this);
constructor(ngModuleType: Type<T>, public _parent: Injector|null) {
super();
@ -76,14 +77,14 @@ export class NgModuleRef<T> extends viewEngine_NgModuleRef<T> implements Interna
return this._r3Injector.get(token, notFoundValue, injectFlags);
}
destroy(): void {
override destroy(): void {
ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
const injector = this._r3Injector;
!injector.destroyed && injector.destroy();
this.destroyCbs!.forEach(fn => fn());
this.destroyCbs = null;
}
onDestroy(callback: () => void): void {
override onDestroy(callback: () => void): void {
ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
this.destroyCbs!.push(callback);
}
@ -122,7 +123,7 @@ export class NgModuleFactory<T> extends viewEngine_NgModuleFactory<T> {
}
}
create(parentInjector: Injector|null): viewEngine_NgModuleRef<T> {
override create(parentInjector: Injector|null): viewEngine_NgModuleRef<T> {
return new NgModuleRef(this.moduleType, parentInjector);
}
}

View File

@ -70,27 +70,27 @@ abstract class SafeValueImpl implements SafeValue {
}
class SafeHtmlImpl extends SafeValueImpl implements SafeHtml {
getTypeName() {
override getTypeName() {
return BypassType.Html;
}
}
class SafeStyleImpl extends SafeValueImpl implements SafeStyle {
getTypeName() {
override getTypeName() {
return BypassType.Style;
}
}
class SafeScriptImpl extends SafeValueImpl implements SafeScript {
getTypeName() {
override getTypeName() {
return BypassType.Script;
}
}
class SafeUrlImpl extends SafeValueImpl implements SafeUrl {
getTypeName() {
override getTypeName() {
return BypassType.Url;
}
}
class SafeResourceUrlImpl extends SafeValueImpl implements SafeResourceUrl {
getTypeName() {
override getTypeName() {
return BypassType.ResourceUrl;
}
}

View File

@ -64,7 +64,7 @@ class NgModuleFactory_ extends NgModuleFactory<any> {
super();
}
create(parentInjector: Injector|null): NgModuleRef<any> {
override create(parentInjector: Injector|null): NgModuleRef<any> {
initServicesIfNeeded();
// Clone the NgModuleDefinition so that any tree shakeable provider definition
// added to this instance of the NgModuleRef doesn't affect the cached copy.

View File

@ -58,7 +58,7 @@ class ComponentFactory_ extends ComponentFactory<any> {
this.viewDefFactory = viewDefFactory;
}
get inputs() {
override get inputs() {
const inputsArr: {propName: string, templateName: string}[] = [];
const inputs = this._inputs!;
for (let propName in inputs) {
@ -68,7 +68,7 @@ class ComponentFactory_ extends ComponentFactory<any> {
return inputsArr;
}
get outputs() {
override get outputs() {
const outputsArr: {propName: string, templateName: string}[] = [];
for (let propName in this._outputs) {
const templateName = this._outputs[propName];
@ -80,7 +80,7 @@ class ComponentFactory_ extends ComponentFactory<any> {
/**
* Creates a new component.
*/
create(
override create(
injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any,
ngModule?: NgModuleRef<any>): ComponentRef<any> {
if (!ngModule) {
@ -100,9 +100,9 @@ class ComponentFactory_ extends ComponentFactory<any> {
}
class ComponentRef_ extends ComponentRef<any> {
public readonly hostView: ViewRef;
public readonly instance: any;
public readonly changeDetectorRef: ChangeDetectorRef;
public override readonly hostView: ViewRef;
public override readonly instance: any;
public override readonly changeDetectorRef: ChangeDetectorRef;
private _elDef: NodeDef;
constructor(private _view: ViewData, private _viewRef: ViewRef, private _component: any) {
super();
@ -111,20 +111,20 @@ class ComponentRef_ extends ComponentRef<any> {
this.changeDetectorRef = _viewRef;
this.instance = _component;
}
get location(): ElementRef {
override get location(): ElementRef {
return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
}
get injector(): Injector {
override get injector(): Injector {
return new Injector_(this._view, this._elDef);
}
get componentType(): Type<any> {
override get componentType(): Type<any> {
return <any>this._component.constructor;
}
destroy(): void {
override destroy(): void {
this._viewRef.destroy();
}
onDestroy(callback: Function): void {
override onDestroy(callback: Function): void {
this._viewRef.onDestroy(callback);
}
}
@ -350,12 +350,12 @@ class TemplateRef_ extends TemplateRef<any> implements TemplateData {
super();
}
createEmbeddedView(context: any): EmbeddedViewRef<any> {
override createEmbeddedView(context: any): EmbeddedViewRef<any> {
return new ViewRef_(Services.createEmbeddedView(
this._parentView, this._def, this._def.element!.template !, context));
}
get elementRef(): ElementRef {
override get elementRef(): ElementRef {
return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
}
}

View File

@ -329,7 +329,7 @@ describe('inheritance', () => {
@Component({selector: 'my-comp', template: ''})
class MyComp extends UndecoratedBase {
@Input() input: any;
@Input() override input: any;
}
@Component({template: '<my-comp [input]="value"></my-comp>'})

View File

@ -21,11 +21,11 @@ export class SimpleDomEventsPlugin extends EventManagerPlugin {
super(doc);
}
supports(eventName: string): boolean {
override supports(eventName: string): boolean {
return true;
}
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {
override addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {
let callback: EventListener = handler as EventListener;
element.addEventListener(eventName, callback, false);
return () => this.removeEventListener(element, eventName, callback);

View File

@ -86,25 +86,25 @@ abstract class OverrideResolver<T> implements Resolver<T> {
export class DirectiveResolver extends OverrideResolver<Directive> {
get type() {
override get type() {
return Directive;
}
}
export class ComponentResolver extends OverrideResolver<Component> {
get type() {
override get type() {
return Component;
}
}
export class PipeResolver extends OverrideResolver<Pipe> {
get type() {
override get type() {
return Pipe;
}
}
export class NgModuleResolver extends OverrideResolver<NgModule> {
get type() {
override get type() {
return NgModule;
}
}

View File

@ -139,7 +139,7 @@ export function createCustomElement<P>(
// field externs. So using quoted access to explicitly prevent renaming.
static readonly['observedAttributes'] = Object.keys(attributeToPropertyInputs);
protected get ngElementStrategy(): NgElementStrategy {
protected override get ngElementStrategy(): NgElementStrategy {
// NOTE:
// Some polyfills (e.g. `document-register-element`) do not call the constructor, therefore
// it is not safe to set `ngElementStrategy` in the constructor and assume it will be
@ -175,13 +175,13 @@ export function createCustomElement<P>(
super();
}
attributeChangedCallback(
override attributeChangedCallback(
attrName: string, oldValue: string|null, newValue: string, namespace?: string): void {
const propName = attributeToPropertyInputs[attrName]!;
this.ngElementStrategy.setInputValue(propName, newValue);
}
connectedCallback(): void {
override connectedCallback(): void {
// For historical reasons, some strategies may not have initialized the `events` property
// until after `connect()` is run. Subscribe to `events` if it is available before running
// `connect()` (in order to capture events emitted suring inittialization), otherwise
@ -208,7 +208,7 @@ export function createCustomElement<P>(
}
}
disconnectedCallback(): void {
override disconnectedCallback(): void {
// Not using `this.ngElementStrategy` to avoid unnecessarily creating the `NgElementStrategy`.
if (this._ngElementStrategy) {
this._ngElementStrategy.disconnect();

View File

@ -451,16 +451,16 @@ export class FakeComponentFactory<T extends Type<any>> extends ComponentFactory<
instance: new this.ComponentClass(),
});
get selector(): string {
override get selector(): string {
return 'fake-component';
}
get componentType(): Type<any> {
override get componentType(): Type<any> {
return this.ComponentClass;
}
get ngContentSelectors(): string[] {
override get ngContentSelectors(): string[] {
return ['content-1', 'content-2'];
}
get inputs(): {propName: string; templateName: string}[] {
override get inputs(): {propName: string; templateName: string}[] {
return [
{propName: 'fooFoo', templateName: 'fooFoo'},
{propName: 'barBar', templateName: 'my-bar-bar'},
@ -471,7 +471,7 @@ export class FakeComponentFactory<T extends Type<any>> extends ComponentFactory<
{propName: 'falsyZero', templateName: 'falsyZero'},
];
}
get outputs(): {propName: string; templateName: string}[] {
override get outputs(): {propName: string; templateName: string}[] {
return [
{propName: 'output1', templateName: 'templateOutput1'},
{propName: 'output2', templateName: 'templateOutput2'},
@ -482,7 +482,7 @@ export class FakeComponentFactory<T extends Type<any>> extends ComponentFactory<
super();
}
create(
override create(
injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any,
ngModule?: NgModuleRef<any>): ComponentRef<any> {
return this.componentRef;

View File

@ -52,7 +52,7 @@ export class AbstractFormGroupDirective extends ControlContainer implements OnIn
* @description
* The `FormGroup` bound to this directive.
*/
get control(): FormGroup {
override get control(): FormGroup {
return this.formDirective!.getFormGroup(this);
}

View File

@ -156,7 +156,7 @@ export class NgForm extends ControlContainer implements Form, AfterViewInit {
* @description
* The internal `FormGroup` instance.
*/
get control(): FormGroup {
override get control(): FormGroup {
return this.form;
}

View File

@ -136,7 +136,7 @@ const resolvedPromise = (() => Promise.resolve(null))();
exportAs: 'ngModel'
})
export class NgModel extends NgControl implements OnChanges, OnDestroy {
public readonly control: FormControl = new FormControl();
public override readonly control: FormControl = new FormControl();
// At runtime we coerce arbitrary values assigned to the "disabled" input to a "boolean".
// This is not reflected in the type of the property because outside of templates, consumers
@ -258,7 +258,7 @@ export class NgModel extends NgControl implements OnChanges, OnDestroy {
*
* @param newValue The new value emitted by `ngModelChange`.
*/
viewToModelUpdate(newValue: any): void {
override viewToModelUpdate(newValue: any): void {
this.viewModel = newValue;
this.update.emit(newValue);
}

View File

@ -157,7 +157,7 @@ export class FormControlDirective extends NgControl implements OnChanges, OnDest
* @description
* The `FormControl` bound to this directive.
*/
get control(): FormControl {
override get control(): FormControl {
return this.form;
}
@ -167,7 +167,7 @@ export class FormControlDirective extends NgControl implements OnChanges, OnDest
*
* @param newValue The new value for the view model.
*/
viewToModelUpdate(newValue: any): void {
override viewToModelUpdate(newValue: any): void {
this.viewModel = newValue;
this.update.emit(newValue);
}

View File

@ -75,7 +75,7 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
* Tracks the `FormControl` instance bound to the directive.
*/
// TODO(issue/24571): remove '!'.
readonly control!: FormControl;
override readonly control!: FormControl;
/**
* @description
@ -166,7 +166,7 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
*
* @param newValue The new value for the view model.
*/
viewToModelUpdate(newValue: any): void {
override viewToModelUpdate(newValue: any): void {
this.viewModel = newValue;
this.update.emit(newValue);
}

View File

@ -140,7 +140,7 @@ export class FormGroupDirective extends ControlContainer implements Form, OnChan
* @description
* Returns the `FormGroup` bound to this directive.
*/
get control(): FormGroup {
override get control(): FormGroup {
return this.form;
}

View File

@ -184,7 +184,7 @@ export class FormArrayName extends ControlContainer implements OnInit, OnDestroy
* @description
* The `FormArray` bound to this directive.
*/
get control(): FormArray {
override get control(): FormArray {
return this.formDirective!.getFormArray(this);
}

View File

@ -176,11 +176,11 @@ export class MaxValidator extends AbstractValidatorDirective implements OnChange
*/
@Input() max!: string|number;
/** @internal */
inputName = 'max';
override inputName = 'max';
/** @internal */
normalizeInput = (input: string): number => parseFloat(input);
override normalizeInput = (input: string): number => parseFloat(input);
/** @internal */
createValidator = (max: number): ValidatorFn => maxValidator(max);
override createValidator = (max: number): ValidatorFn => maxValidator(max);
/**
* Declare `ngOnChanges` lifecycle hook at the main directive level (vs keeping it in base class)
* to avoid differences in handling inheritance of lifecycle hooks between Ivy and ViewEngine in
@ -236,11 +236,11 @@ export class MinValidator extends AbstractValidatorDirective implements OnChange
*/
@Input() min!: string|number;
/** @internal */
inputName = 'min';
override inputName = 'min';
/** @internal */
normalizeInput = (input: string): number => parseFloat(input);
override normalizeInput = (input: string): number => parseFloat(input);
/** @internal */
createValidator = (min: number): ValidatorFn => minValidator(min);
override createValidator = (min: number): ValidatorFn => minValidator(min);
/**
* Declare `ngOnChanges` lifecycle hook at the main directive level (vs keeping it in base class)
* to avoid differences in handling inheritance of lifecycle hooks between Ivy and ViewEngine in

View File

@ -1194,7 +1194,7 @@ export class FormControl extends AbstractControl {
* event to update the model.
*
*/
setValue(value: any, options: {
override setValue(value: any, options: {
onlySelf?: boolean,
emitEvent?: boolean,
emitModelToViewChange?: boolean,
@ -1217,7 +1217,7 @@ export class FormControl extends AbstractControl {
*
* @see `setValue` for options
*/
patchValue(value: any, options: {
override patchValue(value: any, options: {
onlySelf?: boolean,
emitEvent?: boolean,
emitModelToViewChange?: boolean,
@ -1244,7 +1244,8 @@ export class FormControl extends AbstractControl {
* When false, no events are emitted.
*
*/
reset(formState: any = null, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
override reset(formState: any = null, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
void {
this._applyFormState(formState);
this.markAsPristine(options);
this.markAsUntouched(options);
@ -1255,19 +1256,19 @@ export class FormControl extends AbstractControl {
/**
* @internal
*/
_updateValue() {}
override _updateValue() {}
/**
* @internal
*/
_anyControls(condition: Function): boolean {
override _anyControls(condition: Function): boolean {
return false;
}
/**
* @internal
*/
_allControlsDisabled(): boolean {
override _allControlsDisabled(): boolean {
return this.disabled;
}
@ -1308,10 +1309,10 @@ export class FormControl extends AbstractControl {
/**
* @internal
*/
_forEachChild(cb: Function): void {}
override _forEachChild(cb: Function): void {}
/** @internal */
_syncPendingControls(): boolean {
override _syncPendingControls(): boolean {
if (this.updateOn === 'submit') {
if (this._pendingDirty) this.markAsDirty();
if (this._pendingTouched) this.markAsTouched();
@ -1564,8 +1565,8 @@ export class FormGroup extends AbstractControl {
* observables emit events with the latest status and value when the control value is updated.
* When false, no events are emitted.
*/
setValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
void {
override setValue(
value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
this._checkAllValuesPresent(value);
Object.keys(value).forEach(name => {
this._throwIfControlMissing(name);
@ -1605,8 +1606,8 @@ export class FormGroup extends AbstractControl {
* is updated. When false, no events are emitted. The configuration options are passed to
* the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
*/
patchValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
void {
override patchValue(
value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
// Even though the `value` argument type doesn't allow `null` and `undefined` values, the
// `patchValue` can be called recursively and inner data structures might have these values, so
// we just ignore such cases when a field containing FormGroup instance receives `null` or
@ -1678,7 +1679,7 @@ export class FormGroup extends AbstractControl {
* console.log(form.get('first').status); // 'DISABLED'
* ```
*/
reset(value: any = {}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
override reset(value: any = {}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
this._forEachChild((control: AbstractControl, name: string) => {
control.reset(value[name], {onlySelf: true, emitEvent: options.emitEvent});
});
@ -1703,7 +1704,7 @@ export class FormGroup extends AbstractControl {
}
/** @internal */
_syncPendingControls(): boolean {
override _syncPendingControls(): boolean {
let subtreeUpdated = this._reduceChildren(false, (updated: boolean, child: AbstractControl) => {
return child._syncPendingControls() ? true : updated;
});
@ -1725,7 +1726,7 @@ export class FormGroup extends AbstractControl {
}
/** @internal */
_forEachChild(cb: (v: any, k: string) => void): void {
override _forEachChild(cb: (v: any, k: string) => void): void {
Object.keys(this.controls).forEach(key => {
// The list of controls can change (for ex. controls might be removed) while the loop
// is running (as a result of invoking Forms API in `valueChanges` subscription), so we
@ -1744,12 +1745,12 @@ export class FormGroup extends AbstractControl {
}
/** @internal */
_updateValue(): void {
override _updateValue(): void {
(this as {value: any}).value = this._reduceValue();
}
/** @internal */
_anyControls(condition: Function): boolean {
override _anyControls(condition: Function): boolean {
for (const controlName of Object.keys(this.controls)) {
const control = this.controls[controlName];
if (this.contains(controlName) && condition(control)) {
@ -1780,7 +1781,7 @@ export class FormGroup extends AbstractControl {
}
/** @internal */
_allControlsDisabled(): boolean {
override _allControlsDisabled(): boolean {
for (const controlName of Object.keys(this.controls)) {
if (this.controls[controlName].enabled) {
return false;
@ -2021,7 +2022,7 @@ export class FormArray extends AbstractControl {
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
* updateValueAndValidity} method.
*/
setValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
override setValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
this._checkAllValuesPresent(value);
value.forEach((newValue: any, index: number) => {
this._throwIfControlMissing(index);
@ -2062,7 +2063,7 @@ export class FormArray extends AbstractControl {
* is updated. When false, no events are emitted. The configuration options are passed to
* the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
*/
patchValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
override patchValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
// Even though the `value` argument type doesn't allow `null` and `undefined` values, the
// `patchValue` can be called recursively and inner data structures might have these values, so
// we just ignore such cases when a field containing FormArray instance receives `null` or
@ -2123,7 +2124,7 @@ export class FormArray extends AbstractControl {
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
* updateValueAndValidity} method.
*/
reset(value: any = [], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
override reset(value: any = [], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
this._forEachChild((control: AbstractControl, index: number) => {
control.reset(value[index], {onlySelf: true, emitEvent: options.emitEvent});
});
@ -2188,7 +2189,7 @@ export class FormArray extends AbstractControl {
}
/** @internal */
_syncPendingControls(): boolean {
override _syncPendingControls(): boolean {
let subtreeUpdated = this.controls.reduce((updated: boolean, child: AbstractControl) => {
return child._syncPendingControls() ? true : updated;
}, false);
@ -2210,21 +2211,21 @@ export class FormArray extends AbstractControl {
}
/** @internal */
_forEachChild(cb: Function): void {
override _forEachChild(cb: Function): void {
this.controls.forEach((control: AbstractControl, index: number) => {
cb(control, index);
});
}
/** @internal */
_updateValue(): void {
override _updateValue(): void {
(this as {value: any}).value =
this.controls.filter((control) => control.enabled || this.disabled)
.map((control) => control.value);
}
/** @internal */
_anyControls(condition: Function): boolean {
override _anyControls(condition: Function): boolean {
return this.controls.some((control: AbstractControl) => control.enabled && condition(control));
}
@ -2243,7 +2244,7 @@ export class FormArray extends AbstractControl {
}
/** @internal */
_allControlsDisabled(): boolean {
override _allControlsDisabled(): boolean {
for (const control of this.controls) {
if (control.enabled) return false;
}

View File

@ -147,7 +147,7 @@ export interface TwoWayBindingContext {
* the key or value span of a node with key/value spans.
*/
class OutsideKeyValueMarkerAst extends e.AST {
visit(): null {
override visit(): null {
return null;
}
}

View File

@ -87,9 +87,9 @@ abstract class BaseTemplate implements ng.TemplateSource {
* `template` attribute in the decorator.
*/
export class InlineTemplate extends BaseTemplate {
public readonly fileName: string;
public readonly source: string;
public readonly span: ng.Span;
public override readonly fileName: string;
public override readonly source: string;
public override readonly span: ng.Span;
constructor(
templateNode: ts.StringLiteralLike, classDeclNode: ts.ClassDeclaration,
@ -119,7 +119,7 @@ export class InlineTemplate extends BaseTemplate {
* a TS file.
*/
export class ExternalTemplate extends BaseTemplate {
public readonly span: ng.Span;
public override readonly span: ng.Span;
constructor(
public readonly source: string, public readonly fileName: string,

View File

@ -32,7 +32,7 @@ export class DummyHtmlParser extends HtmlParser {
* Avoid loading resources in the language servcie by using a dummy loader.
*/
export class DummyResourceLoader extends ResourceLoader {
get(_url: string): Promise<string> {
override get(_url: string): Promise<string> {
return Promise.resolve('');
}
}

View File

@ -174,7 +174,7 @@ export class DiagnosticContext {
const pipeResolver = new PipeResolver(this.reflector);
const elementSchemaRegistry = new DomElementSchemaRegistry();
const resourceLoader = new class extends ResourceLoader {
get(url: string): Promise<string> {
override get(url: string): Promise<string> {
return Promise.resolve('');
}
};

Some files were not shown because too many files have changed in this diff Show More