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