refactor(compiler): ensure compatibility with noImplicitOverride (#42512)
Adds the `override` keyword to the `compiler` sources to ensure compatibility with `noImplicitOverride`. PR Close #42512
This commit is contained in:
parent
c7d20639c6
commit
96c93260a2
|
@ -396,7 +396,7 @@ export class StaticSymbolResolver {
|
|||
const self = this;
|
||||
|
||||
class ReferenceTransformer extends ValueTransformer {
|
||||
visitStringMap(map: {[key: string]: any}, functionParams: string[]): any {
|
||||
override visitStringMap(map: {[key: string]: any}, functionParams: string[]): any {
|
||||
const symbolic = map['__symbolic'];
|
||||
if (symbolic === 'function') {
|
||||
const oldLen = functionParams.length;
|
||||
|
|
|
@ -234,7 +234,7 @@ class ToJsonSerializer extends ValueTransformer {
|
|||
return visitValue(value, this, flags);
|
||||
}
|
||||
|
||||
visitOther(value: any, context: any): any {
|
||||
override visitOther(value: any, context: any): any {
|
||||
if (value instanceof StaticSymbol) {
|
||||
let baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name);
|
||||
const index = this.visitStaticSymbol(baseSymbol, context);
|
||||
|
@ -249,7 +249,7 @@ class ToJsonSerializer extends ValueTransformer {
|
|||
* TODO: find out a way to have line and character numbers in errors without
|
||||
* excessive recompilation in bazel.
|
||||
*/
|
||||
visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||
override visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||
if (map['__symbolic'] === 'resolved') {
|
||||
return visitValue(map['symbol'], this, context);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ class FromJsonDeserializer extends ValueTransformer {
|
|||
return {moduleName: data.moduleName, summaries, importAs: allImportAs};
|
||||
}
|
||||
|
||||
visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||
override visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||
if ('__symbol' in map) {
|
||||
const baseSymbol = this.symbols[map['__symbol']];
|
||||
const members = map['members'];
|
||||
|
|
|
@ -63,7 +63,9 @@ export interface CompilerFacade {
|
|||
createParseSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan;
|
||||
|
||||
FactoryTarget: typeof FactoryTarget;
|
||||
ResourceLoader: {new(): ResourceLoader};
|
||||
// Note that we do not use `{new(): ResourceLoader}` here because
|
||||
// the resource loader class is abstract and not constructable.
|
||||
ResourceLoader: Function&{prototype: ResourceLoader};
|
||||
}
|
||||
|
||||
export interface CoreEnvironment {
|
||||
|
|
|
@ -300,19 +300,19 @@ class _BuiltinAstConverter extends cdAst.AstTransformer {
|
|||
constructor(private _converterFactory: BuiltinConverterFactory) {
|
||||
super();
|
||||
}
|
||||
visitPipe(ast: cdAst.BindingPipe, context: any): any {
|
||||
override visitPipe(ast: cdAst.BindingPipe, context: any): any {
|
||||
const args = [ast.exp, ...ast.args].map(ast => ast.visit(this, context));
|
||||
return new BuiltinFunctionCall(
|
||||
ast.span, ast.sourceSpan, args,
|
||||
this._converterFactory.createPipeConverter(ast.name, args.length));
|
||||
}
|
||||
visitLiteralArray(ast: cdAst.LiteralArray, context: any): any {
|
||||
override visitLiteralArray(ast: cdAst.LiteralArray, context: any): any {
|
||||
const args = ast.expressions.map(ast => ast.visit(this, context));
|
||||
return new BuiltinFunctionCall(
|
||||
ast.span, ast.sourceSpan, args,
|
||||
this._converterFactory.createLiteralArrayConverter(ast.expressions.length));
|
||||
}
|
||||
visitLiteralMap(ast: cdAst.LiteralMap, context: any): any {
|
||||
override visitLiteralMap(ast: cdAst.LiteralMap, context: any): any {
|
||||
const args = ast.values.map(ast => ast.visit(this, context));
|
||||
|
||||
return new BuiltinFunctionCall(
|
||||
|
@ -1016,7 +1016,7 @@ function convertStmtIntoExpression(stmt: o.Statement): o.Expression|null {
|
|||
|
||||
export class BuiltinFunctionCall extends cdAst.FunctionCall {
|
||||
constructor(
|
||||
span: cdAst.ParseSpan, sourceSpan: cdAst.AbsoluteSourceSpan, public args: cdAst.AST[],
|
||||
span: cdAst.ParseSpan, sourceSpan: cdAst.AbsoluteSourceSpan, args: cdAst.AST[],
|
||||
public converter: BuiltinConverter) {
|
||||
super(span, sourceSpan, null, args);
|
||||
}
|
||||
|
|
|
@ -24,16 +24,16 @@ export class ParseSpan {
|
|||
}
|
||||
}
|
||||
|
||||
export class AST {
|
||||
export abstract class AST {
|
||||
constructor(
|
||||
public span: ParseSpan,
|
||||
/**
|
||||
* Absolute location of the expression AST in a source code file.
|
||||
*/
|
||||
public sourceSpan: AbsoluteSourceSpan) {}
|
||||
visit(visitor: AstVisitor, context: any = null): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
abstract visit(visitor: AstVisitor, context?: any): any;
|
||||
|
||||
toString(): string {
|
||||
return 'AST';
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ export class Quote extends AST {
|
|||
visit(visitor: AstVisitor, context: any = null): any {
|
||||
return visitor.visitQuote(this, context);
|
||||
}
|
||||
toString(): string {
|
||||
override toString(): string {
|
||||
return 'Quote';
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ export class ImplicitReceiver extends AST {
|
|||
* TODO: we should find a way for this class not to extend from `ImplicitReceiver` in the future.
|
||||
*/
|
||||
export class ThisReceiver extends ImplicitReceiver {
|
||||
visit(visitor: AstVisitor, context: any = null): any {
|
||||
override visit(visitor: AstVisitor, context: any = null): any {
|
||||
return visitor.visitThisReceiver?.(this, context);
|
||||
}
|
||||
}
|
||||
|
@ -260,9 +260,9 @@ export class Binary extends AST {
|
|||
export class Unary extends Binary {
|
||||
// Redeclare the properties that are inherited from `Binary` as `never`, as consumers should not
|
||||
// depend on these fields when operating on `Unary`.
|
||||
left: never;
|
||||
right: never;
|
||||
operation: never;
|
||||
override left: never;
|
||||
override right: never;
|
||||
override operation: never;
|
||||
|
||||
/**
|
||||
* Creates a unary minus expression "-x", represented as `Binary` using "0 - x".
|
||||
|
@ -290,7 +290,7 @@ export class Unary extends Binary {
|
|||
super(span, sourceSpan, binaryOp, binaryLeft, binaryRight);
|
||||
}
|
||||
|
||||
visit(visitor: AstVisitor, context: any = null): any {
|
||||
override visit(visitor: AstVisitor, context: any = null): any {
|
||||
if (visitor.visitUnary !== undefined) {
|
||||
return visitor.visitUnary(this, context);
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ export class ASTWithSource extends AST {
|
|||
}
|
||||
return this.ast.visit(visitor, context);
|
||||
}
|
||||
toString(): string {
|
||||
override toString(): string {
|
||||
return `${this.source} in ${this.location}`;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ export class Parser {
|
|||
}
|
||||
|
||||
export class IvyParser extends Parser {
|
||||
simpleExpressionChecker = IvySimpleExpressionChecker;
|
||||
override simpleExpressionChecker = IvySimpleExpressionChecker;
|
||||
}
|
||||
|
||||
/** Describes a stateful context an expression parser is in. */
|
||||
|
@ -1371,7 +1371,7 @@ class SimpleExpressionChecker implements AstVisitor {
|
|||
class IvySimpleExpressionChecker extends RecursiveAstVisitor implements SimpleExpressionChecker {
|
||||
errors: string[] = [];
|
||||
|
||||
visitPipe() {
|
||||
override visitPipe() {
|
||||
this.errors.push('pipes');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ export function serializeNodes(nodes: i18n.Node[]): string[] {
|
|||
* @internal
|
||||
*/
|
||||
class _SerializerIgnoreIcuExpVisitor extends _SerializerVisitor {
|
||||
visitIcu(icu: i18n.Icu, context: any): any {
|
||||
override visitIcu(icu: i18n.Icu, context: any): any {
|
||||
let strCases = Object.keys(icu.cases).map((k: string) => `${k} {${icu.cases[k].visit(this)}}`);
|
||||
// Do not take the expression into account
|
||||
return `{${icu.type}, ${strCases.join(', ')}}`;
|
||||
|
|
|
@ -89,7 +89,8 @@ class MapPlaceholderNames extends i18n.CloneVisitor {
|
|||
return mapper ? nodes.map(n => n.visit(this, mapper)) : nodes;
|
||||
}
|
||||
|
||||
visitTagPlaceholder(ph: i18n.TagPlaceholder, mapper: PlaceholderMapper): i18n.TagPlaceholder {
|
||||
override visitTagPlaceholder(ph: i18n.TagPlaceholder, mapper: PlaceholderMapper):
|
||||
i18n.TagPlaceholder {
|
||||
const startName = mapper.toPublicName(ph.startName)!;
|
||||
const closeName = ph.closeName ? mapper.toPublicName(ph.closeName)! : ph.closeName;
|
||||
const children = ph.children.map(n => n.visit(this, mapper));
|
||||
|
@ -98,11 +99,12 @@ class MapPlaceholderNames extends i18n.CloneVisitor {
|
|||
ph.startSourceSpan, ph.endSourceSpan);
|
||||
}
|
||||
|
||||
visitPlaceholder(ph: i18n.Placeholder, mapper: PlaceholderMapper): i18n.Placeholder {
|
||||
override visitPlaceholder(ph: i18n.Placeholder, mapper: PlaceholderMapper): i18n.Placeholder {
|
||||
return new i18n.Placeholder(ph.value, mapper.toPublicName(ph.name)!, ph.sourceSpan);
|
||||
}
|
||||
|
||||
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, mapper: PlaceholderMapper): i18n.IcuPlaceholder {
|
||||
override visitIcuPlaceholder(ph: i18n.IcuPlaceholder, mapper: PlaceholderMapper):
|
||||
i18n.IcuPlaceholder {
|
||||
return new i18n.IcuPlaceholder(ph.value, mapper.toPublicName(ph.name)!, ph.sourceSpan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,21 +63,21 @@ export class SimplePlaceholderMapper extends i18n.RecurseVisitor implements Plac
|
|||
null;
|
||||
}
|
||||
|
||||
visitText(text: i18n.Text, context?: any): any {
|
||||
override visitText(text: i18n.Text, context?: any): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
visitTagPlaceholder(ph: i18n.TagPlaceholder, context?: any): any {
|
||||
override visitTagPlaceholder(ph: i18n.TagPlaceholder, context?: any): any {
|
||||
this.visitPlaceholderName(ph.startName);
|
||||
super.visitTagPlaceholder(ph, context);
|
||||
this.visitPlaceholderName(ph.closeName);
|
||||
}
|
||||
|
||||
visitPlaceholder(ph: i18n.Placeholder, context?: any): any {
|
||||
override visitPlaceholder(ph: i18n.Placeholder, context?: any): any {
|
||||
this.visitPlaceholderName(ph.name);
|
||||
}
|
||||
|
||||
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): any {
|
||||
override visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): any {
|
||||
this.visitPlaceholderName(ph.name);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ export class Xmb extends Serializer {
|
|||
}
|
||||
|
||||
|
||||
createNameMapper(message: i18n.Message): PlaceholderMapper {
|
||||
override createNameMapper(message: i18n.Message): PlaceholderMapper {
|
||||
return new SimplePlaceholderMapper(message, toPublicName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ export class Xtb extends Serializer {
|
|||
return digest(message);
|
||||
}
|
||||
|
||||
createNameMapper(message: i18n.Message): PlaceholderMapper {
|
||||
override createNameMapper(message: i18n.Message): PlaceholderMapper {
|
||||
return new SimplePlaceholderMapper(message, toPublicName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1268,7 +1268,7 @@ function extractIdentifiers(value: any, targetIdentifiers: cpl.CompileIdentifier
|
|||
}
|
||||
|
||||
class _CompileValueConverter extends ValueTransformer {
|
||||
visitOther(value: any, targetIdentifiers: cpl.CompileIdentifierMetadata[]): any {
|
||||
override visitOther(value: any, targetIdentifiers: cpl.CompileIdentifierMetadata[]): any {
|
||||
targetIdentifiers.push({reference: value});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export class HtmlParser extends Parser {
|
|||
super(getHtmlTagDefinition);
|
||||
}
|
||||
|
||||
parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult {
|
||||
override parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult {
|
||||
return super.parse(source, url, options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1006,22 +1006,22 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|||
}
|
||||
}
|
||||
|
||||
advance(): void {
|
||||
override advance(): void {
|
||||
this.state = this.internalState;
|
||||
super.advance();
|
||||
this.processEscapeSequence();
|
||||
}
|
||||
|
||||
init(): void {
|
||||
override init(): void {
|
||||
super.init();
|
||||
this.processEscapeSequence();
|
||||
}
|
||||
|
||||
clone(): EscapedCharacterCursor {
|
||||
override clone(): EscapedCharacterCursor {
|
||||
return new EscapedCharacterCursor(this);
|
||||
}
|
||||
|
||||
getChars(start: this): string {
|
||||
override getChars(start: this): string {
|
||||
const cursor = start.clone();
|
||||
let chars = '';
|
||||
while (cursor.internalState.offset < this.internalState.offset) {
|
||||
|
|
|
@ -17,7 +17,7 @@ export class XmlParser extends Parser {
|
|||
super(getXmlTagDefinition);
|
||||
}
|
||||
|
||||
parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult {
|
||||
override parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult {
|
||||
return super.parse(source, url, options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,11 +87,11 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|||
ctx.println(stmt, `};`);
|
||||
}
|
||||
|
||||
visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): any {
|
||||
override visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): any {
|
||||
throw new Error('Cannot emit a WrappedNodeExpr in Javascript.');
|
||||
}
|
||||
|
||||
visitReadVarExpr(ast: o.ReadVarExpr, ctx: EmitterVisitorContext): string|null {
|
||||
override visitReadVarExpr(ast: o.ReadVarExpr, ctx: EmitterVisitorContext): string|null {
|
||||
if (ast.builtin === o.BuiltinVar.This) {
|
||||
ctx.print(ast, 'self');
|
||||
} else if (ast.builtin === o.BuiltinVar.Super) {
|
||||
|
@ -115,7 +115,8 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|||
ast.value.visitExpression(this, ctx);
|
||||
return null;
|
||||
}
|
||||
visitInvokeFunctionExpr(expr: o.InvokeFunctionExpr, ctx: EmitterVisitorContext): string|null {
|
||||
override visitInvokeFunctionExpr(expr: o.InvokeFunctionExpr, ctx: EmitterVisitorContext): string
|
||||
|null {
|
||||
const fnExpr = expr.fn;
|
||||
if (fnExpr instanceof o.ReadVarExpr && fnExpr.builtin === o.BuiltinVar.Super) {
|
||||
ctx.currentClass!.parent!.visitExpression(this, ctx);
|
||||
|
@ -130,7 +131,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
visitTaggedTemplateExpr(ast: o.TaggedTemplateExpr, ctx: EmitterVisitorContext): any {
|
||||
override visitTaggedTemplateExpr(ast: o.TaggedTemplateExpr, ctx: EmitterVisitorContext): any {
|
||||
// The following convoluted piece of code is effectively the downlevelled equivalent of
|
||||
// ```
|
||||
// tag`...`
|
||||
|
@ -188,7 +189,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|||
return null;
|
||||
}
|
||||
|
||||
visitLocalizedString(ast: o.LocalizedString, ctx: EmitterVisitorContext): any {
|
||||
override visitLocalizedString(ast: o.LocalizedString, ctx: EmitterVisitorContext): any {
|
||||
// The following convoluted piece of code is effectively the downlevelled equivalent of
|
||||
// ```
|
||||
// $localize `...`
|
||||
|
|
|
@ -54,21 +54,21 @@ class JsEmitterVisitor extends AbstractJsEmitterVisitor {
|
|||
ctx.print(ast, name!);
|
||||
return null;
|
||||
}
|
||||
visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
|
||||
super.visitDeclareVarStmt(stmt, ctx);
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
ctx.println(stmt, exportVar(stmt.name));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
|
||||
super.visitDeclareFunctionStmt(stmt, ctx);
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
ctx.println(stmt, exportVar(stmt.name));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
|
||||
super.visitDeclareClassStmt(stmt, ctx);
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
ctx.println(stmt, exportVar(stmt.name));
|
||||
|
|
|
@ -1050,7 +1050,7 @@ export class JSDocComment extends LeadingComment {
|
|||
constructor(public tags: JSDocTag[]) {
|
||||
super('', /* multiline */ true, /* trailingNewline */ true);
|
||||
}
|
||||
toString(): string {
|
||||
override toString(): string {
|
||||
return serializeTags(this.tags);
|
||||
}
|
||||
}
|
||||
|
@ -1726,15 +1726,15 @@ export function findReadVarNames(stmts: Statement[]): Set<string> {
|
|||
|
||||
class _ReadVarVisitor extends RecursiveAstVisitor {
|
||||
varNames = new Set<string>();
|
||||
visitDeclareFunctionStmt(stmt: DeclareFunctionStmt, context: any): any {
|
||||
override visitDeclareFunctionStmt(stmt: DeclareFunctionStmt, context: any): any {
|
||||
// Don't descend into nested functions
|
||||
return stmt;
|
||||
}
|
||||
visitDeclareClassStmt(stmt: ClassStmt, context: any): any {
|
||||
override visitDeclareClassStmt(stmt: ClassStmt, context: any): any {
|
||||
// Don't descend into nested classes
|
||||
return stmt;
|
||||
}
|
||||
visitReadVarExpr(ast: ReadVarExpr, context: any): any {
|
||||
override visitReadVarExpr(ast: ReadVarExpr, context: any): any {
|
||||
if (ast.name) {
|
||||
this.varNames.add(ast.name);
|
||||
}
|
||||
|
@ -1750,7 +1750,7 @@ export function collectExternalReferences(stmts: Statement[]): ExternalReference
|
|||
|
||||
class _FindExternalReferencesVisitor extends RecursiveAstVisitor {
|
||||
externalReferences: ExternalReference[] = [];
|
||||
visitExternalExpr(e: ExternalExpr, context: any) {
|
||||
override visitExternalExpr(e: ExternalExpr, context: any) {
|
||||
this.externalReferences.push(e.value);
|
||||
return super.visitExternalExpr(e, context);
|
||||
}
|
||||
|
@ -1786,7 +1786,7 @@ class _ApplySourceSpanTransformer extends AstTransformer {
|
|||
return clone;
|
||||
}
|
||||
|
||||
transformExpr(expr: Expression, context: any): Expression {
|
||||
override transformExpr(expr: Expression, context: any): Expression {
|
||||
if (!expr.sourceSpan) {
|
||||
expr = this._clone(expr);
|
||||
expr.sourceSpan = this.sourceSpan;
|
||||
|
@ -1794,7 +1794,7 @@ class _ApplySourceSpanTransformer extends AstTransformer {
|
|||
return expr;
|
||||
}
|
||||
|
||||
transformStmt(stmt: Statement, context: any): Statement {
|
||||
override transformStmt(stmt: Statement, context: any): Statement {
|
||||
if (!stmt.sourceSpan) {
|
||||
stmt = this._clone(stmt);
|
||||
stmt.sourceSpan = this.sourceSpan;
|
||||
|
|
|
@ -124,26 +124,26 @@ export class JitEmitterVisitor extends AbstractJsEmitterVisitor {
|
|||
return null;
|
||||
}
|
||||
|
||||
visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): any {
|
||||
override visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): any {
|
||||
this._emitReferenceToExternal(ast, ast.node, ctx);
|
||||
return null;
|
||||
}
|
||||
|
||||
visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any {
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
this._evalExportedVars.push(stmt.name);
|
||||
}
|
||||
return super.visitDeclareVarStmt(stmt, ctx);
|
||||
}
|
||||
|
||||
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): any {
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
this._evalExportedVars.push(stmt.name);
|
||||
}
|
||||
return super.visitDeclareFunctionStmt(stmt, ctx);
|
||||
}
|
||||
|
||||
visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
|
||||
override visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any {
|
||||
if (stmt.hasModifier(o.StmtModifier.Exported)) {
|
||||
this._evalExportedVars.push(stmt.name);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
|||
}
|
||||
}
|
||||
|
||||
visitLiteralExpr(ast: o.LiteralExpr, ctx: EmitterVisitorContext): any {
|
||||
override visitLiteralExpr(ast: o.LiteralExpr, ctx: EmitterVisitorContext): any {
|
||||
const value = ast.value;
|
||||
if (value == null && ast.type != o.INFERRED_TYPE) {
|
||||
ctx.print(ast, `(${value} as any)`);
|
||||
|
@ -107,7 +107,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
|||
// In SNC mode, [] have the type never[], so we cast here to any[].
|
||||
// TODO: narrow the cast to a more explicit type, or use a pattern that does not
|
||||
// start with [].concat. see https://github.com/angular/angular/pull/11846
|
||||
visitLiteralArrayExpr(ast: o.LiteralArrayExpr, ctx: EmitterVisitorContext): any {
|
||||
override visitLiteralArrayExpr(ast: o.LiteralArrayExpr, ctx: EmitterVisitorContext): any {
|
||||
if (ast.entries.length === 0) {
|
||||
ctx.print(ast, '(');
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
|||
return null;
|
||||
}
|
||||
|
||||
visitAssertNotNullExpr(ast: o.AssertNotNull, ctx: EmitterVisitorContext): any {
|
||||
override visitAssertNotNullExpr(ast: o.AssertNotNull, ctx: EmitterVisitorContext): any {
|
||||
const result = super.visitAssertNotNullExpr(ast, ctx);
|
||||
ctx.print(ast, '!');
|
||||
return result;
|
||||
|
@ -162,7 +162,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
|||
return null;
|
||||
}
|
||||
|
||||
visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): never {
|
||||
override visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): never {
|
||||
throw new Error('Cannot visit a WrappedNodeExpr when outputting Typescript.');
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
|||
return null;
|
||||
}
|
||||
|
||||
visitInstantiateExpr(ast: o.InstantiateExpr, ctx: EmitterVisitorContext): any {
|
||||
override visitInstantiateExpr(ast: o.InstantiateExpr, ctx: EmitterVisitorContext): any {
|
||||
ctx.print(ast, `new `);
|
||||
this.typeExpression++;
|
||||
ast.classExpr.visitExpression(this, ctx);
|
||||
|
|
|
@ -51,7 +51,7 @@ export class R3TargetBinder<DirectiveT extends DirectiveMeta> implements TargetB
|
|||
// Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
||||
// template. This extracts all the metadata that doesn't depend on directive matching.
|
||||
const {expressions, symbols, nestingLevel, usedPipes} =
|
||||
TemplateBinder.apply(target.template, scope);
|
||||
TemplateBinder.applyWithScope(target.template, scope);
|
||||
return new R3BoundTarget(
|
||||
target, directives, bindings, references, expressions, symbols, nestingLevel,
|
||||
templateEntities, usedPipes);
|
||||
|
@ -347,7 +347,7 @@ class TemplateBinder extends RecursiveAstVisitor implements Visitor {
|
|||
// This method is defined to reconcile the type of TemplateBinder since both
|
||||
// RecursiveAstVisitor and Visitor define the visit() method in their
|
||||
// interfaces.
|
||||
visit(node: AST|Node, context?: any) {
|
||||
override visit(node: AST|Node, context?: any) {
|
||||
if (node instanceof AST) {
|
||||
node.visit(this, context);
|
||||
} else {
|
||||
|
@ -367,7 +367,7 @@ class TemplateBinder extends RecursiveAstVisitor implements Visitor {
|
|||
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
||||
* at 1.
|
||||
*/
|
||||
static apply(template: Node[], scope: Scope): {
|
||||
static applyWithScope(template: Node[], scope: Scope): {
|
||||
expressions: Map<AST, Reference|Variable>,
|
||||
symbols: Map<Variable|Reference, Template>,
|
||||
nestingLevel: Map<Template, number>,
|
||||
|
@ -461,7 +461,7 @@ class TemplateBinder extends RecursiveAstVisitor implements Visitor {
|
|||
visitBoundText(text: BoundText) {
|
||||
text.value.visit(this);
|
||||
}
|
||||
visitPipe(ast: BindingPipe, context: any): any {
|
||||
override visitPipe(ast: BindingPipe, context: any): any {
|
||||
this.usedPipes.add(ast.name);
|
||||
return super.visitPipe(ast, context);
|
||||
}
|
||||
|
@ -469,27 +469,27 @@ class TemplateBinder extends RecursiveAstVisitor implements Visitor {
|
|||
// These five types of AST expressions can refer to expression roots, which could be variables
|
||||
// or references in the current scope.
|
||||
|
||||
visitPropertyRead(ast: PropertyRead, context: any): any {
|
||||
override visitPropertyRead(ast: PropertyRead, context: any): any {
|
||||
this.maybeMap(context, ast, ast.name);
|
||||
return super.visitPropertyRead(ast, context);
|
||||
}
|
||||
|
||||
visitSafePropertyRead(ast: SafePropertyRead, context: any): any {
|
||||
override visitSafePropertyRead(ast: SafePropertyRead, context: any): any {
|
||||
this.maybeMap(context, ast, ast.name);
|
||||
return super.visitSafePropertyRead(ast, context);
|
||||
}
|
||||
|
||||
visitPropertyWrite(ast: PropertyWrite, context: any): any {
|
||||
override visitPropertyWrite(ast: PropertyWrite, context: any): any {
|
||||
this.maybeMap(context, ast, ast.name);
|
||||
return super.visitPropertyWrite(ast, context);
|
||||
}
|
||||
|
||||
visitMethodCall(ast: MethodCall, context: any): any {
|
||||
override visitMethodCall(ast: MethodCall, context: any): any {
|
||||
this.maybeMap(context, ast, ast.name);
|
||||
return super.visitMethodCall(ast, context);
|
||||
}
|
||||
|
||||
visitSafeMethodCall(ast: SafeMethodCall, context: any): any {
|
||||
override visitSafeMethodCall(ast: SafeMethodCall, context: any): any {
|
||||
this.maybeMap(context, ast, ast.name);
|
||||
return super.visitSafeMethodCall(ast, context);
|
||||
}
|
||||
|
|
|
@ -1495,7 +1495,7 @@ export class ValueConverter extends AstMemoryEfficientTransformer {
|
|||
}
|
||||
|
||||
// AstMemoryEfficientTransformer
|
||||
visitPipe(pipe: BindingPipe, context: any): AST {
|
||||
override visitPipe(pipe: BindingPipe, context: any): AST {
|
||||
// Allocate a slot to create the pipe
|
||||
const slot = this.allocateSlot();
|
||||
const slotPseudoLocal = `PIPE:${slot}`;
|
||||
|
@ -1528,7 +1528,7 @@ export class ValueConverter extends AstMemoryEfficientTransformer {
|
|||
});
|
||||
}
|
||||
|
||||
visitLiteralArray(array: LiteralArray, context: any): AST {
|
||||
override visitLiteralArray(array: LiteralArray, context: any): AST {
|
||||
return new BuiltinFunctionCall(
|
||||
array.span, array.sourceSpan, this.visitAll(array.expressions), values => {
|
||||
// If the literal has calculated (non-literal) elements transform it into
|
||||
|
@ -1539,7 +1539,7 @@ export class ValueConverter extends AstMemoryEfficientTransformer {
|
|||
});
|
||||
}
|
||||
|
||||
visitLiteralMap(map: LiteralMap, context: any): AST {
|
||||
override visitLiteralMap(map: LiteralMap, context: any): AST {
|
||||
return new BuiltinFunctionCall(map.span, map.sourceSpan, this.visitAll(map.values), values => {
|
||||
// If the literal has calculated (non-literal) elements transform it into
|
||||
// calls to literal factories that compose the literal and will cache intermediate
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* An interface for retrieving documents by URL that the compiler uses
|
||||
* to load templates.
|
||||
* An interface for retrieving documents by URL that the compiler uses to
|
||||
* load templates.
|
||||
*
|
||||
* This is an abstract class, rather than an interface, so that it can be used
|
||||
* as injection token.
|
||||
*/
|
||||
export class ResourceLoader {
|
||||
get(url: string): Promise<string>|string {
|
||||
return '';
|
||||
}
|
||||
export abstract class ResourceLoader {
|
||||
abstract get(url: string): Promise<string>|string;
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ export class BindingParser {
|
|||
|
||||
export class PipeCollector extends RecursiveAstVisitor {
|
||||
pipes = new Map<string, BindingPipe>();
|
||||
visitPipe(ast: BindingPipe, context: any): any {
|
||||
override visitPipe(ast: BindingPipe, context: any): any {
|
||||
this.pipes.set(ast.name, ast);
|
||||
ast.exp.visit(this);
|
||||
this.visitAll(ast.args, context);
|
||||
|
|
|
@ -328,7 +328,7 @@ export class RecursiveTemplateAstVisitor extends NullTemplateVisitor implements
|
|||
}
|
||||
|
||||
// Nodes with children
|
||||
visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any {
|
||||
override visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any {
|
||||
return this.visitChildren(context, visit => {
|
||||
visit(ast.attrs);
|
||||
visit(ast.references);
|
||||
|
@ -339,7 +339,7 @@ export class RecursiveTemplateAstVisitor extends NullTemplateVisitor implements
|
|||
});
|
||||
}
|
||||
|
||||
visitElement(ast: ElementAst, context: any): any {
|
||||
override visitElement(ast: ElementAst, context: any): any {
|
||||
return this.visitChildren(context, visit => {
|
||||
visit(ast.attrs);
|
||||
visit(ast.inputs);
|
||||
|
@ -351,7 +351,7 @@ export class RecursiveTemplateAstVisitor extends NullTemplateVisitor implements
|
|||
});
|
||||
}
|
||||
|
||||
visitDirective(ast: DirectiveAst, context: any): any {
|
||||
override visitDirective(ast: DirectiveAst, context: any): any {
|
||||
return this.visitChildren(context, visit => {
|
||||
visit(ast.inputs);
|
||||
visit(ast.hostProperties);
|
||||
|
|
|
@ -227,7 +227,7 @@ class SomeDirectiveWithoutMetadata {}
|
|||
}
|
||||
|
||||
class Child extends Parent {
|
||||
@Input('p22') p2: any;
|
||||
@Input('p22') override p2: any;
|
||||
@Input() p3: any;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ class SomeDirectiveWithoutMetadata {}
|
|||
}
|
||||
|
||||
class Child extends Parent {
|
||||
@Output('p22') p2: any;
|
||||
@Output('p22') override p2: any;
|
||||
@Output() p3: any;
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ class SomeDirectiveWithoutMetadata {}
|
|||
}
|
||||
|
||||
class Child extends Parent {
|
||||
@HostBinding('p22') p2: any;
|
||||
@HostBinding('p22') override p2: any;
|
||||
@HostBinding() p3: any;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ class SomeDirectiveWithoutMetadata {}
|
|||
|
||||
class Child extends Parent {
|
||||
@HostListener('p22')
|
||||
p2() {
|
||||
override p2() {
|
||||
}
|
||||
@HostListener('p3')
|
||||
p3() {
|
||||
|
@ -375,10 +375,10 @@ class SomeDirectiveWithoutMetadata {}
|
|||
|
||||
class Child extends Parent {
|
||||
@HostListener('c1')
|
||||
p1() {
|
||||
override p1() {
|
||||
}
|
||||
|
||||
@HostBinding('c2') p2: any;
|
||||
@HostBinding('c2') override p2: any;
|
||||
}
|
||||
|
||||
const directiveMetadata = resolver.resolve(Child);
|
||||
|
@ -426,7 +426,7 @@ class SomeDirectiveWithoutMetadata {}
|
|||
}
|
||||
|
||||
class Child extends Parent {
|
||||
@ContentChild('p22') p2: any;
|
||||
@ContentChild('p22') override p2: any;
|
||||
@ContentChild('p3') p3: any;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('RecursiveAstVisitor', () => {
|
|||
});
|
||||
|
||||
class Visitor extends RecursiveAstVisitor {
|
||||
visit(node: AST, path: AST[]) {
|
||||
override visit(node: AST, path: AST[]) {
|
||||
path.push(node);
|
||||
node.visit(this, path);
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ export function unparseWithSpan(
|
|||
]);
|
||||
}
|
||||
|
||||
visit(ast: AST, unparsedList: UnparsedWithSpan[]) {
|
||||
override visit(ast: AST, unparsedList: UnparsedWithSpan[]) {
|
||||
this.recordUnparsed(ast, 'span', unparsedList);
|
||||
if (ast.hasOwnProperty('nameSpan')) {
|
||||
this.recordUnparsed(ast, 'nameSpan', unparsedList);
|
||||
|
|
|
@ -13,7 +13,7 @@ import {unparse} from './unparser';
|
|||
class ASTValidator extends RecursiveAstVisitor {
|
||||
private parentSpan: ParseSpan|undefined;
|
||||
|
||||
visit(ast: AST) {
|
||||
override visit(ast: AST) {
|
||||
this.parentSpan = undefined;
|
||||
ast.visit(this);
|
||||
}
|
||||
|
@ -34,87 +34,87 @@ class ASTValidator extends RecursiveAstVisitor {
|
|||
this.parentSpan = oldParent;
|
||||
}
|
||||
|
||||
visitUnary(ast: Unary, context: any): any {
|
||||
override visitUnary(ast: Unary, context: any): any {
|
||||
this.validate(ast, () => super.visitUnary(ast, context));
|
||||
}
|
||||
|
||||
visitBinary(ast: Binary, context: any): any {
|
||||
override visitBinary(ast: Binary, context: any): any {
|
||||
this.validate(ast, () => super.visitBinary(ast, context));
|
||||
}
|
||||
|
||||
visitChain(ast: Chain, context: any): any {
|
||||
override visitChain(ast: Chain, context: any): any {
|
||||
this.validate(ast, () => super.visitChain(ast, context));
|
||||
}
|
||||
|
||||
visitConditional(ast: Conditional, context: any): any {
|
||||
override visitConditional(ast: Conditional, context: any): any {
|
||||
this.validate(ast, () => super.visitConditional(ast, context));
|
||||
}
|
||||
|
||||
visitFunctionCall(ast: FunctionCall, context: any): any {
|
||||
override visitFunctionCall(ast: FunctionCall, context: any): any {
|
||||
this.validate(ast, () => super.visitFunctionCall(ast, context));
|
||||
}
|
||||
|
||||
visitImplicitReceiver(ast: ImplicitReceiver, context: any): any {
|
||||
override visitImplicitReceiver(ast: ImplicitReceiver, context: any): any {
|
||||
this.validate(ast, () => super.visitImplicitReceiver(ast, context));
|
||||
}
|
||||
|
||||
visitInterpolation(ast: Interpolation, context: any): any {
|
||||
override visitInterpolation(ast: Interpolation, context: any): any {
|
||||
this.validate(ast, () => super.visitInterpolation(ast, context));
|
||||
}
|
||||
|
||||
visitKeyedRead(ast: KeyedRead, context: any): any {
|
||||
override visitKeyedRead(ast: KeyedRead, context: any): any {
|
||||
this.validate(ast, () => super.visitKeyedRead(ast, context));
|
||||
}
|
||||
|
||||
visitKeyedWrite(ast: KeyedWrite, context: any): any {
|
||||
override visitKeyedWrite(ast: KeyedWrite, context: any): any {
|
||||
this.validate(ast, () => super.visitKeyedWrite(ast, context));
|
||||
}
|
||||
|
||||
visitLiteralArray(ast: LiteralArray, context: any): any {
|
||||
override visitLiteralArray(ast: LiteralArray, context: any): any {
|
||||
this.validate(ast, () => super.visitLiteralArray(ast, context));
|
||||
}
|
||||
|
||||
visitLiteralMap(ast: LiteralMap, context: any): any {
|
||||
override visitLiteralMap(ast: LiteralMap, context: any): any {
|
||||
this.validate(ast, () => super.visitLiteralMap(ast, context));
|
||||
}
|
||||
|
||||
visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any {
|
||||
override visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any {
|
||||
this.validate(ast, () => super.visitLiteralPrimitive(ast, context));
|
||||
}
|
||||
|
||||
visitMethodCall(ast: MethodCall, context: any): any {
|
||||
override visitMethodCall(ast: MethodCall, context: any): any {
|
||||
this.validate(ast, () => super.visitMethodCall(ast, context));
|
||||
}
|
||||
|
||||
visitPipe(ast: BindingPipe, context: any): any {
|
||||
override visitPipe(ast: BindingPipe, context: any): any {
|
||||
this.validate(ast, () => super.visitPipe(ast, context));
|
||||
}
|
||||
|
||||
visitPrefixNot(ast: PrefixNot, context: any): any {
|
||||
override visitPrefixNot(ast: PrefixNot, context: any): any {
|
||||
this.validate(ast, () => super.visitPrefixNot(ast, context));
|
||||
}
|
||||
|
||||
visitPropertyRead(ast: PropertyRead, context: any): any {
|
||||
override visitPropertyRead(ast: PropertyRead, context: any): any {
|
||||
this.validate(ast, () => super.visitPropertyRead(ast, context));
|
||||
}
|
||||
|
||||
visitPropertyWrite(ast: PropertyWrite, context: any): any {
|
||||
override visitPropertyWrite(ast: PropertyWrite, context: any): any {
|
||||
this.validate(ast, () => super.visitPropertyWrite(ast, context));
|
||||
}
|
||||
|
||||
visitQuote(ast: Quote, context: any): any {
|
||||
override visitQuote(ast: Quote, context: any): any {
|
||||
this.validate(ast, () => super.visitQuote(ast, context));
|
||||
}
|
||||
|
||||
visitSafeMethodCall(ast: SafeMethodCall, context: any): any {
|
||||
override visitSafeMethodCall(ast: SafeMethodCall, context: any): any {
|
||||
this.validate(ast, () => super.visitSafeMethodCall(ast, context));
|
||||
}
|
||||
|
||||
visitSafePropertyRead(ast: SafePropertyRead, context: any): any {
|
||||
override visitSafePropertyRead(ast: SafePropertyRead, context: any): any {
|
||||
this.validate(ast, () => super.visitSafePropertyRead(ast, context));
|
||||
}
|
||||
|
||||
visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any {
|
||||
override visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any {
|
||||
this.validate(ast, () => super.visitSafeKeyedRead(ast, context));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,15 +58,15 @@ class RecurseVisitor extends i18n.RecurseVisitor {
|
|||
phCount = 0;
|
||||
icuPhCount = 0;
|
||||
|
||||
visitText(text: i18n.Text, context?: any): any {
|
||||
override visitText(text: i18n.Text, context?: any): any {
|
||||
this.textCount++;
|
||||
}
|
||||
|
||||
visitPlaceholder(ph: i18n.Placeholder, context?: any): any {
|
||||
override visitPlaceholder(ph: i18n.Placeholder, context?: any): any {
|
||||
this.phCount++;
|
||||
}
|
||||
|
||||
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): any {
|
||||
override visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): any {
|
||||
this.icuPhCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Visit
|
|||
// This method is defined to reconcile the type of ExpressionSourceHumanizer
|
||||
// since both RecursiveAstVisitor and Visitor define the visit() method in
|
||||
// their interfaces.
|
||||
visit(node: e.AST|t.Node, context?: any) {
|
||||
override visit(node: e.AST|t.Node, context?: any) {
|
||||
if (node instanceof e.AST) {
|
||||
node.visit(this, context);
|
||||
} else {
|
||||
|
@ -34,87 +34,87 @@ class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Visit
|
|||
this.recordAst(ast);
|
||||
this.visitAll([ast.ast], null);
|
||||
}
|
||||
visitBinary(ast: e.Binary) {
|
||||
override visitBinary(ast: e.Binary) {
|
||||
this.recordAst(ast);
|
||||
super.visitBinary(ast, null);
|
||||
}
|
||||
visitChain(ast: e.Chain) {
|
||||
override visitChain(ast: e.Chain) {
|
||||
this.recordAst(ast);
|
||||
super.visitChain(ast, null);
|
||||
}
|
||||
visitConditional(ast: e.Conditional) {
|
||||
override visitConditional(ast: e.Conditional) {
|
||||
this.recordAst(ast);
|
||||
super.visitConditional(ast, null);
|
||||
}
|
||||
visitFunctionCall(ast: e.FunctionCall) {
|
||||
override visitFunctionCall(ast: e.FunctionCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitFunctionCall(ast, null);
|
||||
}
|
||||
visitImplicitReceiver(ast: e.ImplicitReceiver) {
|
||||
override visitImplicitReceiver(ast: e.ImplicitReceiver) {
|
||||
this.recordAst(ast);
|
||||
super.visitImplicitReceiver(ast, null);
|
||||
}
|
||||
visitInterpolation(ast: e.Interpolation) {
|
||||
override visitInterpolation(ast: e.Interpolation) {
|
||||
this.recordAst(ast);
|
||||
super.visitInterpolation(ast, null);
|
||||
}
|
||||
visitKeyedRead(ast: e.KeyedRead) {
|
||||
override visitKeyedRead(ast: e.KeyedRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitKeyedRead(ast, null);
|
||||
}
|
||||
visitKeyedWrite(ast: e.KeyedWrite) {
|
||||
override visitKeyedWrite(ast: e.KeyedWrite) {
|
||||
this.recordAst(ast);
|
||||
super.visitKeyedWrite(ast, null);
|
||||
}
|
||||
visitLiteralPrimitive(ast: e.LiteralPrimitive) {
|
||||
override visitLiteralPrimitive(ast: e.LiteralPrimitive) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralPrimitive(ast, null);
|
||||
}
|
||||
visitLiteralArray(ast: e.LiteralArray) {
|
||||
override visitLiteralArray(ast: e.LiteralArray) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralArray(ast, null);
|
||||
}
|
||||
visitLiteralMap(ast: e.LiteralMap) {
|
||||
override visitLiteralMap(ast: e.LiteralMap) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralMap(ast, null);
|
||||
}
|
||||
visitMethodCall(ast: e.MethodCall) {
|
||||
override visitMethodCall(ast: e.MethodCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitMethodCall(ast, null);
|
||||
}
|
||||
visitNonNullAssert(ast: e.NonNullAssert) {
|
||||
override visitNonNullAssert(ast: e.NonNullAssert) {
|
||||
this.recordAst(ast);
|
||||
super.visitNonNullAssert(ast, null);
|
||||
}
|
||||
visitPipe(ast: e.BindingPipe) {
|
||||
override visitPipe(ast: e.BindingPipe) {
|
||||
this.recordAst(ast);
|
||||
super.visitPipe(ast, null);
|
||||
}
|
||||
visitPrefixNot(ast: e.PrefixNot) {
|
||||
override visitPrefixNot(ast: e.PrefixNot) {
|
||||
this.recordAst(ast);
|
||||
super.visitPrefixNot(ast, null);
|
||||
}
|
||||
visitPropertyRead(ast: e.PropertyRead) {
|
||||
override visitPropertyRead(ast: e.PropertyRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitPropertyRead(ast, null);
|
||||
}
|
||||
visitPropertyWrite(ast: e.PropertyWrite) {
|
||||
override visitPropertyWrite(ast: e.PropertyWrite) {
|
||||
this.recordAst(ast);
|
||||
super.visitPropertyWrite(ast, null);
|
||||
}
|
||||
visitSafeMethodCall(ast: e.SafeMethodCall) {
|
||||
override visitSafeMethodCall(ast: e.SafeMethodCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafeMethodCall(ast, null);
|
||||
}
|
||||
visitSafePropertyRead(ast: e.SafePropertyRead) {
|
||||
override visitSafePropertyRead(ast: e.SafePropertyRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafePropertyRead(ast, null);
|
||||
}
|
||||
visitQuote(ast: e.Quote) {
|
||||
override visitQuote(ast: e.Quote) {
|
||||
this.recordAst(ast);
|
||||
super.visitQuote(ast, null);
|
||||
}
|
||||
visitSafeKeyedRead(ast: e.SafeKeyedRead) {
|
||||
override visitSafeKeyedRead(ast: e.SafeKeyedRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafeKeyedRead(ast, null);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class FakeUrlResolver extends UrlResolver {
|
|||
super();
|
||||
}
|
||||
|
||||
resolve(baseUrl: string, url: string): string {
|
||||
override resolve(baseUrl: string, url: string): string {
|
||||
return 'fake_resolved_url';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ class ThrowingVisitor implements TemplateAstVisitor {
|
|||
}
|
||||
|
||||
class FooAstTransformer extends ThrowingVisitor {
|
||||
visitElement(ast: ElementAst, context: any): any {
|
||||
override visitElement(ast: ElementAst, context: any): any {
|
||||
if (ast.name != 'div') return ast;
|
||||
return new ElementAst(
|
||||
'foo', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan,
|
||||
|
@ -247,7 +247,7 @@ class FooAstTransformer extends ThrowingVisitor {
|
|||
}
|
||||
|
||||
class BarAstTransformer extends FooAstTransformer {
|
||||
visitElement(ast: ElementAst, context: any): any {
|
||||
override visitElement(ast: ElementAst, context: any): any {
|
||||
if (ast.name != 'foo') return ast;
|
||||
return new ElementAst(
|
||||
'bar', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan,
|
||||
|
@ -340,7 +340,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit NgContentAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitNgContent(ast: NgContentAst, context: any): any {
|
||||
override visitNgContent(ast: NgContentAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new NgContentAst(0, 0, null!));
|
||||
|
@ -348,7 +348,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit EmbeddedTemplateAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any) {
|
||||
override visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any) {
|
||||
return ast;
|
||||
}
|
||||
}, new EmbeddedTemplateAst([], [], [], [], [], [], false, [], [], 0, null!));
|
||||
|
@ -356,7 +356,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit ElementAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitElement(ast: ElementAst, context: any) {
|
||||
override visitElement(ast: ElementAst, context: any) {
|
||||
return ast;
|
||||
}
|
||||
}, new ElementAst('foo', [], [], [], [], [], [], false, [], [], 0, null!, null!));
|
||||
|
@ -364,7 +364,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit RefererenceAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitReference(ast: ReferenceAst, context: any): any {
|
||||
override visitReference(ast: ReferenceAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new ReferenceAst('foo', null!, null!, null!));
|
||||
|
@ -372,7 +372,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit VariableAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitVariable(ast: VariableAst, context: any): any {
|
||||
override visitVariable(ast: VariableAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new VariableAst('foo', 'bar', null!));
|
||||
|
@ -380,7 +380,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit BoundEventAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitEvent(ast: BoundEventAst, context: any): any {
|
||||
override visitEvent(ast: BoundEventAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new BoundEventAst('foo', 'bar', 'goo', null!, null!, null!));
|
||||
|
@ -388,7 +388,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit BoundElementPropertyAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitElementProperty(ast: BoundElementPropertyAst, context: any): any {
|
||||
override visitElementProperty(ast: BoundElementPropertyAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new BoundElementPropertyAst('foo', null!, null!, null!, 'bar', null!));
|
||||
|
@ -396,7 +396,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit AttrAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitAttr(ast: AttrAst, context: any): any {
|
||||
override visitAttr(ast: AttrAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new AttrAst('foo', 'bar', null!));
|
||||
|
@ -404,7 +404,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit BoundTextAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitBoundText(ast: BoundTextAst, context: any): any {
|
||||
override visitBoundText(ast: BoundTextAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new BoundTextAst(null!, 0, null!));
|
||||
|
@ -412,7 +412,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit TextAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitText(ast: TextAst, context: any): any {
|
||||
override visitText(ast: TextAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new TextAst('foo', 0, null!));
|
||||
|
@ -420,7 +420,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit DirectiveAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitDirective(ast: DirectiveAst, context: any): any {
|
||||
override visitDirective(ast: DirectiveAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new DirectiveAst(null!, [], [], [], 0, null!));
|
||||
|
@ -428,7 +428,7 @@ describe('TemplateAstVisitor', () => {
|
|||
|
||||
it('should visit DirectiveAst', () => {
|
||||
expectVisitedNode(new class extends NullVisitor {
|
||||
visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any {
|
||||
override visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any {
|
||||
return ast;
|
||||
}
|
||||
}, new BoundDirectivePropertyAst('foo', 'bar', null!, null!));
|
||||
|
|
|
@ -22,7 +22,7 @@ class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Templ
|
|||
// This method is defined to reconcile the type of ExpressionSourceHumanizer
|
||||
// since both RecursiveAstVisitor and TemplateAstVisitor define the visit()
|
||||
// method in their interfaces.
|
||||
visit(node: e.AST|t.TemplateAst, context?: any) {
|
||||
override visit(node: e.AST|t.TemplateAst, context?: any) {
|
||||
node.visit(this, context);
|
||||
}
|
||||
|
||||
|
@ -30,91 +30,91 @@ class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Templ
|
|||
this.recordAst(ast);
|
||||
this.visitAll([ast.ast], null);
|
||||
}
|
||||
visitUnary(ast: e.Unary) {
|
||||
override visitUnary(ast: e.Unary) {
|
||||
this.recordAst(ast);
|
||||
super.visitUnary(ast, null);
|
||||
}
|
||||
visitBinary(ast: e.Binary) {
|
||||
override visitBinary(ast: e.Binary) {
|
||||
this.recordAst(ast);
|
||||
super.visitBinary(ast, null);
|
||||
}
|
||||
visitChain(ast: e.Chain) {
|
||||
override visitChain(ast: e.Chain) {
|
||||
this.recordAst(ast);
|
||||
super.visitChain(ast, null);
|
||||
}
|
||||
visitConditional(ast: e.Conditional) {
|
||||
override visitConditional(ast: e.Conditional) {
|
||||
this.recordAst(ast);
|
||||
super.visitConditional(ast, null);
|
||||
}
|
||||
visitFunctionCall(ast: e.FunctionCall) {
|
||||
override visitFunctionCall(ast: e.FunctionCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitFunctionCall(ast, null);
|
||||
}
|
||||
visitImplicitReceiver(ast: e.ImplicitReceiver) {
|
||||
override visitImplicitReceiver(ast: e.ImplicitReceiver) {
|
||||
this.recordAst(ast);
|
||||
super.visitImplicitReceiver(ast, null);
|
||||
}
|
||||
visitInterpolation(ast: e.Interpolation) {
|
||||
override visitInterpolation(ast: e.Interpolation) {
|
||||
this.recordAst(ast);
|
||||
super.visitInterpolation(ast, null);
|
||||
}
|
||||
visitKeyedRead(ast: e.KeyedRead) {
|
||||
override visitKeyedRead(ast: e.KeyedRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitKeyedRead(ast, null);
|
||||
}
|
||||
visitKeyedWrite(ast: e.KeyedWrite) {
|
||||
override visitKeyedWrite(ast: e.KeyedWrite) {
|
||||
this.recordAst(ast);
|
||||
super.visitKeyedWrite(ast, null);
|
||||
}
|
||||
visitLiteralPrimitive(ast: e.LiteralPrimitive) {
|
||||
override visitLiteralPrimitive(ast: e.LiteralPrimitive) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralPrimitive(ast, null);
|
||||
}
|
||||
visitLiteralArray(ast: e.LiteralArray) {
|
||||
override visitLiteralArray(ast: e.LiteralArray) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralArray(ast, null);
|
||||
}
|
||||
visitLiteralMap(ast: e.LiteralMap) {
|
||||
override visitLiteralMap(ast: e.LiteralMap) {
|
||||
this.recordAst(ast);
|
||||
super.visitLiteralMap(ast, null);
|
||||
}
|
||||
visitMethodCall(ast: e.MethodCall) {
|
||||
override visitMethodCall(ast: e.MethodCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitMethodCall(ast, null);
|
||||
}
|
||||
visitNonNullAssert(ast: e.NonNullAssert) {
|
||||
override visitNonNullAssert(ast: e.NonNullAssert) {
|
||||
this.recordAst(ast);
|
||||
super.visitNonNullAssert(ast, null);
|
||||
}
|
||||
visitPipe(ast: e.BindingPipe) {
|
||||
override visitPipe(ast: e.BindingPipe) {
|
||||
this.recordAst(ast);
|
||||
super.visitPipe(ast, null);
|
||||
}
|
||||
visitPrefixNot(ast: e.PrefixNot) {
|
||||
override visitPrefixNot(ast: e.PrefixNot) {
|
||||
this.recordAst(ast);
|
||||
super.visitPrefixNot(ast, null);
|
||||
}
|
||||
visitPropertyRead(ast: e.PropertyRead) {
|
||||
override visitPropertyRead(ast: e.PropertyRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitPropertyRead(ast, null);
|
||||
}
|
||||
visitPropertyWrite(ast: e.PropertyWrite) {
|
||||
override visitPropertyWrite(ast: e.PropertyWrite) {
|
||||
this.recordAst(ast);
|
||||
super.visitPropertyWrite(ast, null);
|
||||
}
|
||||
visitSafeMethodCall(ast: e.SafeMethodCall) {
|
||||
override visitSafeMethodCall(ast: e.SafeMethodCall) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafeMethodCall(ast, null);
|
||||
}
|
||||
visitSafePropertyRead(ast: e.SafePropertyRead) {
|
||||
override visitSafePropertyRead(ast: e.SafePropertyRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafePropertyRead(ast, null);
|
||||
}
|
||||
visitQuote(ast: e.Quote) {
|
||||
override visitQuote(ast: e.Quote) {
|
||||
this.recordAst(ast);
|
||||
super.visitQuote(ast, null);
|
||||
}
|
||||
visitSafeKeyedRead(ast: e.SafeKeyedRead) {
|
||||
override visitSafeKeyedRead(ast: e.SafeKeyedRead) {
|
||||
this.recordAst(ast);
|
||||
super.visitSafeKeyedRead(ast, null);
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
|||
super(reflector);
|
||||
}
|
||||
|
||||
resolve(type: core.Type): core.Directive;
|
||||
resolve(type: core.Type, throwIfNotFound: true): core.Directive;
|
||||
resolve(type: core.Type, throwIfNotFound: boolean): core.Directive|null;
|
||||
resolve(type: core.Type, throwIfNotFound = true): core.Directive|null {
|
||||
override resolve(type: core.Type): core.Directive;
|
||||
override resolve(type: core.Type, throwIfNotFound: true): core.Directive;
|
||||
override resolve(type: core.Type, throwIfNotFound: boolean): core.Directive|null;
|
||||
override resolve(type: core.Type, throwIfNotFound = true): core.Directive|null {
|
||||
return this._directives.get(type) || super.resolve(type, throwIfNotFound);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ export class MockNgModuleResolver extends NgModuleResolver {
|
|||
* default
|
||||
* `NgModuleResolver`, see `setNgModule`.
|
||||
*/
|
||||
resolve(type: core.Type, throwIfNotFound = true): core.NgModule {
|
||||
override resolve(type: core.Type, throwIfNotFound = true): core.NgModule {
|
||||
return this._ngModules.get(type) || super.resolve(type, throwIfNotFound)!;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export class MockPipeResolver extends PipeResolver {
|
|||
* default
|
||||
* `PipeResolver`, see `setPipe`.
|
||||
*/
|
||||
resolve(type: core.Type, throwIfNotFound = true): core.Pipe {
|
||||
override resolve(type: core.Type, throwIfNotFound = true): core.Pipe {
|
||||
let metadata = this._pipes.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound)!;
|
||||
|
|
Loading…
Reference in New Issue