Paul Gschwendtner 96c93260a2 refactor(compiler): ensure compatibility with noImplicitOverride (#42512)
Adds the `override` keyword to the `compiler` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
2021-07-12 13:11:14 -07:00

39 lines
1019 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {CompileReflector, core, PipeResolver} from '@angular/compiler';
export class MockPipeResolver extends PipeResolver {
private _pipes = new Map<core.Type, core.Pipe>();
constructor(refector: CompileReflector) {
super(refector);
}
/**
* Overrides the {@link Pipe} for a pipe.
*/
setPipe(type: core.Type, metadata: core.Pipe): void {
this._pipes.set(type, metadata);
}
/**
* Returns the {@link Pipe} for a pipe:
* - Set the {@link Pipe} to the overridden view when it exists or fallback to the
* default
* `PipeResolver`, see `setPipe`.
*/
override resolve(type: core.Type, throwIfNotFound = true): core.Pipe {
let metadata = this._pipes.get(type);
if (!metadata) {
metadata = super.resolve(type, throwIfNotFound)!;
}
return metadata;
}
}