mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Remove accept method from syntax nodes
This commit is contained in:
@@ -2275,6 +2275,7 @@ function generateBrands(definition, accessibility) {
|
||||
types.push(type);
|
||||
}
|
||||
}
|
||||
types.push("_syntaxNodeOrTokenBrand");
|
||||
if (types.length > 0) {
|
||||
properties += " ";
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
@@ -2583,7 +2584,6 @@ function generateNode(definition, abstract) {
|
||||
}
|
||||
result += " }\r\n";
|
||||
result += generateKindMethod(definition);
|
||||
result += generateAcceptMethod(definition);
|
||||
result += " }";
|
||||
return result;
|
||||
}
|
||||
@@ -2702,7 +2702,7 @@ function generateRewriter() {
|
||||
}
|
||||
function generateWalker() {
|
||||
var result = "";
|
||||
result += "///<reference path='references.ts' />\r\n" + "\r\n" + "module TypeScript {\r\n" + " export class SyntaxWalker implements ISyntaxVisitor {\r\n" + " public visitToken(token: ISyntaxToken): void {\r\n" + " }\r\n" + "\r\n" + " private visitOptionalToken(token: ISyntaxToken): void {\r\n" + " if (token === undefined) {\r\n" + " return;\r\n" + " }\r\n" + "\r\n" + " this.visitToken(token);\r\n" + " }\r\n" + "\r\n" + " private visitOptionalNode(node: ISyntaxNode): void {\r\n" + " if (node === undefined) {\r\n" + " return;\r\n" + " }\r\n" + "\r\n" + " node.accept(this);\r\n" + " }\r\n" + "\r\n" + " public visitList(list: ISyntaxNodeOrToken[]): void {\r\n" + " for (var i = 0, n = list.length; i < n; i++) {\r\n" + " list[i].accept(this);\r\n" + " }\r\n" + " }\r\n" + "\r\n";
|
||||
result += "///<reference path='references.ts' />\r\n" + "\r\n" + "module TypeScript {\r\n" + " export class SyntaxWalker implements ISyntaxVisitor {\r\n" + " public visitToken(token: ISyntaxToken): void {\r\n" + " }\r\n" + "\r\n" + " private visitOptionalToken(token: ISyntaxToken): void {\r\n" + " if (token === undefined) {\r\n" + " return;\r\n" + " }\r\n" + "\r\n" + " this.visitToken(token);\r\n" + " }\r\n" + "\r\n" + " public visitList(list: ISyntaxNodeOrToken[]): void {\r\n" + " for (var i = 0, n = list.length; i < n; i++) {\r\n" + " visitNodeOrToken(this, list[i]);\r\n" + " }\r\n" + " }\r\n";
|
||||
for (var i = 0; i < definitions.length; i++) {
|
||||
var definition = definitions[i];
|
||||
result += "\r\n";
|
||||
@@ -2721,12 +2721,7 @@ function generateWalker() {
|
||||
result += " this.visitList(node." + child.name + ");\r\n";
|
||||
}
|
||||
else if (isNodeOrToken(child)) {
|
||||
if (child.isOptional) {
|
||||
result += " visitNodeOrToken(this, node." + child.name + ");\r\n";
|
||||
}
|
||||
else {
|
||||
result += " node." + child.name + ".accept(this);\r\n";
|
||||
}
|
||||
result += " visitNodeOrToken(this, node." + child.name + ");\r\n";
|
||||
}
|
||||
else if (child.type === "ISyntaxToken") {
|
||||
if (child.isOptional) {
|
||||
@@ -2737,12 +2732,7 @@ function generateWalker() {
|
||||
}
|
||||
}
|
||||
else if (child.type !== "SyntaxKind") {
|
||||
if (child.isOptional) {
|
||||
result += " this.visitOptionalNode(node." + child.name + ");\r\n";
|
||||
}
|
||||
else {
|
||||
result += " node." + child.name + ".accept(this);\r\n";
|
||||
}
|
||||
result += " visitNodeOrToken(this, node." + child.name + ");\r\n";
|
||||
}
|
||||
}
|
||||
result += " }\r\n";
|
||||
@@ -2865,7 +2855,14 @@ function generateVisitor() {
|
||||
result += "module TypeScript {\r\n";
|
||||
result += " export function visitNodeOrToken(visitor: ISyntaxVisitor, element: ISyntaxNodeOrToken): any {\r\n";
|
||||
result += " if (element === undefined) { return undefined; }\r\n";
|
||||
result += " return element.accept(visitor);\r\n";
|
||||
result += " switch (element.kind()) {\r\n";
|
||||
for (var i = 0; i < definitions.length; i++) {
|
||||
var definition = definitions[i];
|
||||
result += " case SyntaxKind." + getNameWithoutSuffix(definition) + ": ";
|
||||
result += "return visitor.visit" + getNameWithoutSuffix(definition) + "(<" + definition.name + ">element);\r\n";
|
||||
}
|
||||
result += " default: return visitor.visitToken(<ISyntaxToken>element);\r\n";
|
||||
result += " }\r\n";
|
||||
result += " }\r\n\r\n";
|
||||
result += " export interface ISyntaxVisitor {\r\n";
|
||||
result += " visitToken(token: ISyntaxToken): any;\r\n";
|
||||
|
||||
@@ -1031,15 +1031,15 @@ module TypeScript.PrettyPrinter {
|
||||
}
|
||||
|
||||
public visitTemplateClause(node: TemplateClauseSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.ensureSpace();
|
||||
this.appendToken(node.templateMiddleOrEndToken);
|
||||
}
|
||||
|
||||
public visitTemplateAccessExpression(node: TemplateAccessExpressionSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.ensureSpace();
|
||||
node.templateExpression.accept(this);
|
||||
visitNodeOrToken(this, node.templateExpression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ module TypeScript.Scanner {
|
||||
}
|
||||
|
||||
class FixedWidthTokenWithNoTrivia implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any;
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
|
||||
constructor(private _packedData: number) {
|
||||
}
|
||||
@@ -285,7 +285,7 @@ module TypeScript.Scanner {
|
||||
}
|
||||
|
||||
class LargeScannerToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any;
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
|
||||
private cachedText: string;
|
||||
constructor(private _packedFullStartAndInfo: number, private _packedFullWidthAndKind: number, cachedText: string) {
|
||||
|
||||
@@ -1565,6 +1565,7 @@ function generateBrands(definition: ITypeDefinition, accessibility: boolean): st
|
||||
}
|
||||
}
|
||||
|
||||
types.push("_syntaxNodeOrTokenBrand");
|
||||
if (types.length > 0) {
|
||||
properties += " ";
|
||||
|
||||
@@ -2008,7 +2009,7 @@ function generateNode(definition: ITypeDefinition, abstract: boolean): string {
|
||||
|
||||
result += generateKindMethod(definition);
|
||||
// result += generateSlotMethods(definition);
|
||||
result += generateAcceptMethod(definition);
|
||||
// result += generateAcceptMethod(definition);
|
||||
|
||||
result += " }";
|
||||
return result;
|
||||
@@ -2213,35 +2214,26 @@ function generateWalker(): string {
|
||||
var result = "";
|
||||
|
||||
result +=
|
||||
"///<reference path='references.ts' />\r\n"+
|
||||
"\r\n" +
|
||||
"module TypeScript {\r\n" +
|
||||
" export class SyntaxWalker implements ISyntaxVisitor {\r\n" +
|
||||
" public visitToken(token: ISyntaxToken): void {\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" private visitOptionalToken(token: ISyntaxToken): void {\r\n" +
|
||||
" if (token === undefined) {\r\n" +
|
||||
" return;\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" this.visitToken(token);\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" private visitOptionalNode(node: ISyntaxNode): void {\r\n" +
|
||||
" if (node === undefined) {\r\n" +
|
||||
" return;\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" node.accept(this);\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" public visitList(list: ISyntaxNodeOrToken[]): void {\r\n" +
|
||||
" for (var i = 0, n = list.length; i < n; i++) {\r\n" +
|
||||
" list[i].accept(this);\r\n" +
|
||||
" }\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n";
|
||||
"///<reference path='references.ts' />\r\n" +
|
||||
"\r\n" +
|
||||
"module TypeScript {\r\n" +
|
||||
" export class SyntaxWalker implements ISyntaxVisitor {\r\n" +
|
||||
" public visitToken(token: ISyntaxToken): void {\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" private visitOptionalToken(token: ISyntaxToken): void {\r\n" +
|
||||
" if (token === undefined) {\r\n" +
|
||||
" return;\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" this.visitToken(token);\r\n" +
|
||||
" }\r\n" +
|
||||
"\r\n" +
|
||||
" public visitList(list: ISyntaxNodeOrToken[]): void {\r\n" +
|
||||
" for (var i = 0, n = list.length; i < n; i++) {\r\n" +
|
||||
" visitNodeOrToken(this, list[i]);\r\n" +
|
||||
" }\r\n" +
|
||||
" }\r\n";
|
||||
|
||||
for (var i = 0; i < definitions.length; i++) {
|
||||
var definition = definitions[i];
|
||||
@@ -2264,12 +2256,12 @@ function generateWalker(): string {
|
||||
result += " this.visitList(node." + child.name + ");\r\n";
|
||||
}
|
||||
else if (isNodeOrToken(child)) {
|
||||
if (child.isOptional) {
|
||||
//if (child.isOptional) {
|
||||
result += " visitNodeOrToken(this, node." + child.name + ");\r\n";
|
||||
}
|
||||
else {
|
||||
result += " node." + child.name + ".accept(this);\r\n";
|
||||
}
|
||||
//}
|
||||
//else {
|
||||
// result += " node." + child.name + ".accept(this);\r\n";
|
||||
//}
|
||||
}
|
||||
else if (child.type === "ISyntaxToken") {
|
||||
if (child.isOptional) {
|
||||
@@ -2280,12 +2272,12 @@ function generateWalker(): string {
|
||||
}
|
||||
}
|
||||
else if (child.type !== "SyntaxKind") {
|
||||
if (child.isOptional) {
|
||||
result += " this.visitOptionalNode(node." + child.name + ");\r\n";
|
||||
}
|
||||
else {
|
||||
result += " node." + child.name + ".accept(this);\r\n";
|
||||
}
|
||||
//if (child.isOptional) {
|
||||
result += " visitNodeOrToken(this, node." + child.name + ");\r\n";
|
||||
//}
|
||||
//else {
|
||||
// result += " node." + child.name + ".accept(this);\r\n";
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2455,31 +2447,19 @@ function generateVisitor(): string {
|
||||
result += "module TypeScript {\r\n";
|
||||
result += " export function visitNodeOrToken(visitor: ISyntaxVisitor, element: ISyntaxNodeOrToken): any {\r\n";
|
||||
result += " if (element === undefined) { return undefined; }\r\n";
|
||||
result += " return element.accept(visitor);\r\n";
|
||||
/*
|
||||
result += " if (isToken(element)) { return visitor.visitToken(<ISyntaxToken>element); }\r\n";
|
||||
// result += " return element.accept(visitor);\r\n";
|
||||
|
||||
result += " switch (element.kind()) {\r\n";
|
||||
|
||||
for (var i = 0; i < definitions.length; i++) {
|
||||
var definition = definitions[i];
|
||||
|
||||
if (definition.syntaxKinds) {
|
||||
result += " ";
|
||||
for (var j = 0; j < definition.syntaxKinds.length; j++) {
|
||||
result += " case SyntaxKind." + definition.syntaxKinds[j] + ":"
|
||||
}
|
||||
result += "\r\n ";
|
||||
}
|
||||
else {
|
||||
result += " case SyntaxKind." + getNameWithoutSuffix(definition) + ": ";
|
||||
}
|
||||
|
||||
result += " case SyntaxKind." + getNameWithoutSuffix(definition) + ": ";
|
||||
result += "return visitor.visit" + getNameWithoutSuffix(definition) + "(<" + definition.name + ">element);\r\n";
|
||||
}
|
||||
|
||||
result += " }\r\n\r\n";
|
||||
result += " throw Errors.invalidOperation();\r\n";
|
||||
*/
|
||||
result += " default: return visitor.visitToken(<ISyntaxToken>element);\r\n";
|
||||
result += " }\r\n";
|
||||
result += " }\r\n\r\n";
|
||||
|
||||
result += " export interface ISyntaxVisitor {\r\n";
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
module TypeScript {
|
||||
export interface ISyntaxNodeOrToken extends ISyntaxElement {
|
||||
accept(visitor: ISyntaxVisitor): any;
|
||||
_syntaxNodeOrTokenBrand: any;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -304,7 +304,7 @@ module TypeScript.Syntax {
|
||||
}
|
||||
|
||||
class EmptyToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any;
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
|
||||
constructor(private _kind: SyntaxKind) {
|
||||
}
|
||||
@@ -427,7 +427,7 @@ module TypeScript.Syntax {
|
||||
private _text: string;
|
||||
private _trailingTrivia: ISyntaxTriviaList;
|
||||
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any;
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
|
||||
constructor(fullStart: number,
|
||||
kind: SyntaxKind,
|
||||
@@ -496,7 +496,7 @@ module TypeScript.Syntax {
|
||||
}
|
||||
|
||||
class ConvertedKeywordToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any;
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
|
||||
constructor(private underlyingToken: ISyntaxToken) {
|
||||
}
|
||||
|
||||
@@ -3,7 +3,100 @@
|
||||
module TypeScript {
|
||||
export function visitNodeOrToken(visitor: ISyntaxVisitor, element: ISyntaxNodeOrToken): any {
|
||||
if (element === undefined) { return undefined; }
|
||||
return element.accept(visitor);
|
||||
switch (element.kind()) {
|
||||
case SyntaxKind.SourceUnit: return visitor.visitSourceUnit(<SourceUnitSyntax>element);
|
||||
case SyntaxKind.QualifiedName: return visitor.visitQualifiedName(<QualifiedNameSyntax>element);
|
||||
case SyntaxKind.ObjectType: return visitor.visitObjectType(<ObjectTypeSyntax>element);
|
||||
case SyntaxKind.FunctionType: return visitor.visitFunctionType(<FunctionTypeSyntax>element);
|
||||
case SyntaxKind.ArrayType: return visitor.visitArrayType(<ArrayTypeSyntax>element);
|
||||
case SyntaxKind.ConstructorType: return visitor.visitConstructorType(<ConstructorTypeSyntax>element);
|
||||
case SyntaxKind.GenericType: return visitor.visitGenericType(<GenericTypeSyntax>element);
|
||||
case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(<TypeQuerySyntax>element);
|
||||
case SyntaxKind.TupleType: return visitor.visitTupleType(<TupleTypeSyntax>element);
|
||||
case SyntaxKind.UnionType: return visitor.visitUnionType(<UnionTypeSyntax>element);
|
||||
case SyntaxKind.ParenthesizedType: return visitor.visitParenthesizedType(<ParenthesizedTypeSyntax>element);
|
||||
case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(<InterfaceDeclarationSyntax>element);
|
||||
case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(<FunctionDeclarationSyntax>element);
|
||||
case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(<ModuleDeclarationSyntax>element);
|
||||
case SyntaxKind.ClassDeclaration: return visitor.visitClassDeclaration(<ClassDeclarationSyntax>element);
|
||||
case SyntaxKind.EnumDeclaration: return visitor.visitEnumDeclaration(<EnumDeclarationSyntax>element);
|
||||
case SyntaxKind.ImportDeclaration: return visitor.visitImportDeclaration(<ImportDeclarationSyntax>element);
|
||||
case SyntaxKind.ExportAssignment: return visitor.visitExportAssignment(<ExportAssignmentSyntax>element);
|
||||
case SyntaxKind.MemberFunctionDeclaration: return visitor.visitMemberFunctionDeclaration(<MemberFunctionDeclarationSyntax>element);
|
||||
case SyntaxKind.MemberVariableDeclaration: return visitor.visitMemberVariableDeclaration(<MemberVariableDeclarationSyntax>element);
|
||||
case SyntaxKind.ConstructorDeclaration: return visitor.visitConstructorDeclaration(<ConstructorDeclarationSyntax>element);
|
||||
case SyntaxKind.IndexMemberDeclaration: return visitor.visitIndexMemberDeclaration(<IndexMemberDeclarationSyntax>element);
|
||||
case SyntaxKind.GetAccessor: return visitor.visitGetAccessor(<GetAccessorSyntax>element);
|
||||
case SyntaxKind.SetAccessor: return visitor.visitSetAccessor(<SetAccessorSyntax>element);
|
||||
case SyntaxKind.PropertySignature: return visitor.visitPropertySignature(<PropertySignatureSyntax>element);
|
||||
case SyntaxKind.CallSignature: return visitor.visitCallSignature(<CallSignatureSyntax>element);
|
||||
case SyntaxKind.ConstructSignature: return visitor.visitConstructSignature(<ConstructSignatureSyntax>element);
|
||||
case SyntaxKind.IndexSignature: return visitor.visitIndexSignature(<IndexSignatureSyntax>element);
|
||||
case SyntaxKind.MethodSignature: return visitor.visitMethodSignature(<MethodSignatureSyntax>element);
|
||||
case SyntaxKind.Block: return visitor.visitBlock(<BlockSyntax>element);
|
||||
case SyntaxKind.IfStatement: return visitor.visitIfStatement(<IfStatementSyntax>element);
|
||||
case SyntaxKind.VariableStatement: return visitor.visitVariableStatement(<VariableStatementSyntax>element);
|
||||
case SyntaxKind.ExpressionStatement: return visitor.visitExpressionStatement(<ExpressionStatementSyntax>element);
|
||||
case SyntaxKind.ReturnStatement: return visitor.visitReturnStatement(<ReturnStatementSyntax>element);
|
||||
case SyntaxKind.SwitchStatement: return visitor.visitSwitchStatement(<SwitchStatementSyntax>element);
|
||||
case SyntaxKind.BreakStatement: return visitor.visitBreakStatement(<BreakStatementSyntax>element);
|
||||
case SyntaxKind.ContinueStatement: return visitor.visitContinueStatement(<ContinueStatementSyntax>element);
|
||||
case SyntaxKind.ForStatement: return visitor.visitForStatement(<ForStatementSyntax>element);
|
||||
case SyntaxKind.ForInStatement: return visitor.visitForInStatement(<ForInStatementSyntax>element);
|
||||
case SyntaxKind.EmptyStatement: return visitor.visitEmptyStatement(<EmptyStatementSyntax>element);
|
||||
case SyntaxKind.ThrowStatement: return visitor.visitThrowStatement(<ThrowStatementSyntax>element);
|
||||
case SyntaxKind.WhileStatement: return visitor.visitWhileStatement(<WhileStatementSyntax>element);
|
||||
case SyntaxKind.TryStatement: return visitor.visitTryStatement(<TryStatementSyntax>element);
|
||||
case SyntaxKind.LabeledStatement: return visitor.visitLabeledStatement(<LabeledStatementSyntax>element);
|
||||
case SyntaxKind.DoStatement: return visitor.visitDoStatement(<DoStatementSyntax>element);
|
||||
case SyntaxKind.DebuggerStatement: return visitor.visitDebuggerStatement(<DebuggerStatementSyntax>element);
|
||||
case SyntaxKind.WithStatement: return visitor.visitWithStatement(<WithStatementSyntax>element);
|
||||
case SyntaxKind.PrefixUnaryExpression: return visitor.visitPrefixUnaryExpression(<PrefixUnaryExpressionSyntax>element);
|
||||
case SyntaxKind.DeleteExpression: return visitor.visitDeleteExpression(<DeleteExpressionSyntax>element);
|
||||
case SyntaxKind.TypeOfExpression: return visitor.visitTypeOfExpression(<TypeOfExpressionSyntax>element);
|
||||
case SyntaxKind.VoidExpression: return visitor.visitVoidExpression(<VoidExpressionSyntax>element);
|
||||
case SyntaxKind.ConditionalExpression: return visitor.visitConditionalExpression(<ConditionalExpressionSyntax>element);
|
||||
case SyntaxKind.BinaryExpression: return visitor.visitBinaryExpression(<BinaryExpressionSyntax>element);
|
||||
case SyntaxKind.PostfixUnaryExpression: return visitor.visitPostfixUnaryExpression(<PostfixUnaryExpressionSyntax>element);
|
||||
case SyntaxKind.MemberAccessExpression: return visitor.visitMemberAccessExpression(<MemberAccessExpressionSyntax>element);
|
||||
case SyntaxKind.InvocationExpression: return visitor.visitInvocationExpression(<InvocationExpressionSyntax>element);
|
||||
case SyntaxKind.ArrayLiteralExpression: return visitor.visitArrayLiteralExpression(<ArrayLiteralExpressionSyntax>element);
|
||||
case SyntaxKind.ObjectLiteralExpression: return visitor.visitObjectLiteralExpression(<ObjectLiteralExpressionSyntax>element);
|
||||
case SyntaxKind.ObjectCreationExpression: return visitor.visitObjectCreationExpression(<ObjectCreationExpressionSyntax>element);
|
||||
case SyntaxKind.ParenthesizedExpression: return visitor.visitParenthesizedExpression(<ParenthesizedExpressionSyntax>element);
|
||||
case SyntaxKind.ParenthesizedArrowFunctionExpression: return visitor.visitParenthesizedArrowFunctionExpression(<ParenthesizedArrowFunctionExpressionSyntax>element);
|
||||
case SyntaxKind.SimpleArrowFunctionExpression: return visitor.visitSimpleArrowFunctionExpression(<SimpleArrowFunctionExpressionSyntax>element);
|
||||
case SyntaxKind.CastExpression: return visitor.visitCastExpression(<CastExpressionSyntax>element);
|
||||
case SyntaxKind.ElementAccessExpression: return visitor.visitElementAccessExpression(<ElementAccessExpressionSyntax>element);
|
||||
case SyntaxKind.FunctionExpression: return visitor.visitFunctionExpression(<FunctionExpressionSyntax>element);
|
||||
case SyntaxKind.OmittedExpression: return visitor.visitOmittedExpression(<OmittedExpressionSyntax>element);
|
||||
case SyntaxKind.TemplateExpression: return visitor.visitTemplateExpression(<TemplateExpressionSyntax>element);
|
||||
case SyntaxKind.TemplateAccessExpression: return visitor.visitTemplateAccessExpression(<TemplateAccessExpressionSyntax>element);
|
||||
case SyntaxKind.VariableDeclaration: return visitor.visitVariableDeclaration(<VariableDeclarationSyntax>element);
|
||||
case SyntaxKind.VariableDeclarator: return visitor.visitVariableDeclarator(<VariableDeclaratorSyntax>element);
|
||||
case SyntaxKind.ArgumentList: return visitor.visitArgumentList(<ArgumentListSyntax>element);
|
||||
case SyntaxKind.ParameterList: return visitor.visitParameterList(<ParameterListSyntax>element);
|
||||
case SyntaxKind.TypeArgumentList: return visitor.visitTypeArgumentList(<TypeArgumentListSyntax>element);
|
||||
case SyntaxKind.TypeParameterList: return visitor.visitTypeParameterList(<TypeParameterListSyntax>element);
|
||||
case SyntaxKind.HeritageClause: return visitor.visitHeritageClause(<HeritageClauseSyntax>element);
|
||||
case SyntaxKind.EqualsValueClause: return visitor.visitEqualsValueClause(<EqualsValueClauseSyntax>element);
|
||||
case SyntaxKind.CaseSwitchClause: return visitor.visitCaseSwitchClause(<CaseSwitchClauseSyntax>element);
|
||||
case SyntaxKind.DefaultSwitchClause: return visitor.visitDefaultSwitchClause(<DefaultSwitchClauseSyntax>element);
|
||||
case SyntaxKind.ElseClause: return visitor.visitElseClause(<ElseClauseSyntax>element);
|
||||
case SyntaxKind.CatchClause: return visitor.visitCatchClause(<CatchClauseSyntax>element);
|
||||
case SyntaxKind.FinallyClause: return visitor.visitFinallyClause(<FinallyClauseSyntax>element);
|
||||
case SyntaxKind.TemplateClause: return visitor.visitTemplateClause(<TemplateClauseSyntax>element);
|
||||
case SyntaxKind.TypeParameter: return visitor.visitTypeParameter(<TypeParameterSyntax>element);
|
||||
case SyntaxKind.Constraint: return visitor.visitConstraint(<ConstraintSyntax>element);
|
||||
case SyntaxKind.SimplePropertyAssignment: return visitor.visitSimplePropertyAssignment(<SimplePropertyAssignmentSyntax>element);
|
||||
case SyntaxKind.FunctionPropertyAssignment: return visitor.visitFunctionPropertyAssignment(<FunctionPropertyAssignmentSyntax>element);
|
||||
case SyntaxKind.Parameter: return visitor.visitParameter(<ParameterSyntax>element);
|
||||
case SyntaxKind.EnumElement: return visitor.visitEnumElement(<EnumElementSyntax>element);
|
||||
case SyntaxKind.TypeAnnotation: return visitor.visitTypeAnnotation(<TypeAnnotationSyntax>element);
|
||||
case SyntaxKind.ExternalModuleReference: return visitor.visitExternalModuleReference(<ExternalModuleReferenceSyntax>element);
|
||||
case SyntaxKind.ModuleNameModuleReference: return visitor.visitModuleNameModuleReference(<ModuleNameModuleReferenceSyntax>element);
|
||||
default: return visitor.visitToken(<ISyntaxToken>element);
|
||||
}
|
||||
}
|
||||
|
||||
export interface ISyntaxVisitor {
|
||||
|
||||
@@ -13,28 +13,19 @@ module TypeScript {
|
||||
this.visitToken(token);
|
||||
}
|
||||
|
||||
private visitOptionalNode(node: ISyntaxNode): void {
|
||||
if (node === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
node.accept(this);
|
||||
}
|
||||
|
||||
public visitList(list: ISyntaxNodeOrToken[]): void {
|
||||
for (var i = 0, n = list.length; i < n; i++) {
|
||||
list[i].accept(this);
|
||||
visitNodeOrToken(this, list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public visitSourceUnit(node: SourceUnitSyntax): void {
|
||||
this.visitList(node.moduleElements);
|
||||
this.visitToken(node.endOfFileToken);
|
||||
}
|
||||
|
||||
public visitQualifiedName(node: QualifiedNameSyntax): void {
|
||||
node.left.accept(this);
|
||||
visitNodeOrToken(this, node.left);
|
||||
this.visitToken(node.dotToken);
|
||||
this.visitToken(node.right);
|
||||
}
|
||||
@@ -46,34 +37,34 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitFunctionType(node: FunctionTypeSyntax): void {
|
||||
this.visitOptionalNode(node.typeParameterList);
|
||||
node.parameterList.accept(this);
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
visitNodeOrToken(this, node.parameterList);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
}
|
||||
|
||||
public visitArrayType(node: ArrayTypeSyntax): void {
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.visitToken(node.openBracketToken);
|
||||
this.visitToken(node.closeBracketToken);
|
||||
}
|
||||
|
||||
public visitConstructorType(node: ConstructorTypeSyntax): void {
|
||||
this.visitToken(node.newKeyword);
|
||||
this.visitOptionalNode(node.typeParameterList);
|
||||
node.parameterList.accept(this);
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
visitNodeOrToken(this, node.parameterList);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
}
|
||||
|
||||
public visitGenericType(node: GenericTypeSyntax): void {
|
||||
node.name.accept(this);
|
||||
node.typeArgumentList.accept(this);
|
||||
visitNodeOrToken(this, node.name);
|
||||
visitNodeOrToken(this, node.typeArgumentList);
|
||||
}
|
||||
|
||||
public visitTypeQuery(node: TypeQuerySyntax): void {
|
||||
this.visitToken(node.typeOfKeyword);
|
||||
node.name.accept(this);
|
||||
visitNodeOrToken(this, node.name);
|
||||
}
|
||||
|
||||
public visitTupleType(node: TupleTypeSyntax): void {
|
||||
@@ -83,14 +74,14 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitUnionType(node: UnionTypeSyntax): void {
|
||||
node.left.accept(this);
|
||||
visitNodeOrToken(this, node.left);
|
||||
this.visitToken(node.barToken);
|
||||
node.right.accept(this);
|
||||
visitNodeOrToken(this, node.right);
|
||||
}
|
||||
|
||||
public visitParenthesizedType(node: ParenthesizedTypeSyntax): void {
|
||||
this.visitToken(node.openParenToken);
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.visitToken(node.closeParenToken);
|
||||
}
|
||||
|
||||
@@ -98,17 +89,17 @@ module TypeScript {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.interfaceKeyword);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalNode(node.typeParameterList);
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
this.visitList(node.heritageClauses);
|
||||
node.body.accept(this);
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitFunctionDeclaration(node: FunctionDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.functionKeyword);
|
||||
this.visitToken(node.identifier);
|
||||
node.callSignature.accept(this);
|
||||
this.visitOptionalNode(node.block);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
@@ -126,7 +117,7 @@ module TypeScript {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.classKeyword);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalNode(node.typeParameterList);
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
this.visitList(node.heritageClauses);
|
||||
this.visitToken(node.openBraceToken);
|
||||
this.visitList(node.classElements);
|
||||
@@ -147,7 +138,7 @@ module TypeScript {
|
||||
this.visitToken(node.importKeyword);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitToken(node.equalsToken);
|
||||
node.moduleReference.accept(this);
|
||||
visitNodeOrToken(this, node.moduleReference);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
@@ -161,28 +152,28 @@ module TypeScript {
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.propertyName);
|
||||
node.callSignature.accept(this);
|
||||
this.visitOptionalNode(node.block);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitMemberVariableDeclaration(node: MemberVariableDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
node.variableDeclarator.accept(this);
|
||||
visitNodeOrToken(this, node.variableDeclarator);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitConstructorDeclaration(node: ConstructorDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.constructorKeyword);
|
||||
node.callSignature.accept(this);
|
||||
this.visitOptionalNode(node.block);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitIndexMemberDeclaration(node: IndexMemberDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
node.indexSignature.accept(this);
|
||||
visitNodeOrToken(this, node.indexSignature);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
@@ -190,46 +181,46 @@ module TypeScript {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.getKeyword);
|
||||
this.visitToken(node.propertyName);
|
||||
node.callSignature.accept(this);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitSetAccessor(node: SetAccessorSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.setKeyword);
|
||||
this.visitToken(node.propertyName);
|
||||
node.callSignature.accept(this);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitPropertySignature(node: PropertySignatureSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
this.visitOptionalToken(node.questionToken);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
}
|
||||
|
||||
public visitCallSignature(node: CallSignatureSyntax): void {
|
||||
this.visitOptionalNode(node.typeParameterList);
|
||||
node.parameterList.accept(this);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
visitNodeOrToken(this, node.parameterList);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
}
|
||||
|
||||
public visitConstructSignature(node: ConstructSignatureSyntax): void {
|
||||
this.visitToken(node.newKeyword);
|
||||
node.callSignature.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
}
|
||||
|
||||
public visitIndexSignature(node: IndexSignatureSyntax): void {
|
||||
this.visitToken(node.openBracketToken);
|
||||
this.visitList(node.parameters);
|
||||
this.visitToken(node.closeBracketToken);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
}
|
||||
|
||||
public visitMethodSignature(node: MethodSignatureSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
this.visitOptionalToken(node.questionToken);
|
||||
node.callSignature.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
}
|
||||
|
||||
public visitBlock(node: BlockSyntax): void {
|
||||
@@ -241,20 +232,20 @@ module TypeScript {
|
||||
public visitIfStatement(node: IfStatementSyntax): void {
|
||||
this.visitToken(node.ifKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
node.condition.accept(this);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.statement.accept(this);
|
||||
this.visitOptionalNode(node.elseClause);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
visitNodeOrToken(this, node.elseClause);
|
||||
}
|
||||
|
||||
public visitVariableStatement(node: VariableStatementSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
node.variableDeclaration.accept(this);
|
||||
visitNodeOrToken(this, node.variableDeclaration);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitExpressionStatement(node: ExpressionStatementSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
@@ -267,7 +258,7 @@ module TypeScript {
|
||||
public visitSwitchStatement(node: SwitchStatementSyntax): void {
|
||||
this.visitToken(node.switchKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.closeParenToken);
|
||||
this.visitToken(node.openBraceToken);
|
||||
this.visitList(node.switchClauses);
|
||||
@@ -289,25 +280,25 @@ module TypeScript {
|
||||
public visitForStatement(node: ForStatementSyntax): void {
|
||||
this.visitToken(node.forKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
this.visitOptionalNode(node.variableDeclaration);
|
||||
visitNodeOrToken(this, node.variableDeclaration);
|
||||
visitNodeOrToken(this, node.initializer);
|
||||
this.visitToken(node.firstSemicolonToken);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.secondSemicolonToken);
|
||||
visitNodeOrToken(this, node.incrementor);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitForInStatement(node: ForInStatementSyntax): void {
|
||||
this.visitToken(node.forKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
this.visitOptionalNode(node.variableDeclaration);
|
||||
visitNodeOrToken(this, node.variableDeclaration);
|
||||
visitNodeOrToken(this, node.left);
|
||||
this.visitToken(node.inKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitEmptyStatement(node: EmptyStatementSyntax): void {
|
||||
@@ -316,37 +307,37 @@ module TypeScript {
|
||||
|
||||
public visitThrowStatement(node: ThrowStatementSyntax): void {
|
||||
this.visitToken(node.throwKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitWhileStatement(node: WhileStatementSyntax): void {
|
||||
this.visitToken(node.whileKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
node.condition.accept(this);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitTryStatement(node: TryStatementSyntax): void {
|
||||
this.visitToken(node.tryKeyword);
|
||||
node.block.accept(this);
|
||||
this.visitOptionalNode(node.catchClause);
|
||||
this.visitOptionalNode(node.finallyClause);
|
||||
visitNodeOrToken(this, node.block);
|
||||
visitNodeOrToken(this, node.catchClause);
|
||||
visitNodeOrToken(this, node.finallyClause);
|
||||
}
|
||||
|
||||
public visitLabeledStatement(node: LabeledStatementSyntax): void {
|
||||
this.visitToken(node.identifier);
|
||||
this.visitToken(node.colonToken);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitDoStatement(node: DoStatementSyntax): void {
|
||||
this.visitToken(node.doKeyword);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
this.visitToken(node.whileKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
node.condition.accept(this);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.closeParenToken);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
@@ -359,59 +350,59 @@ module TypeScript {
|
||||
public visitWithStatement(node: WithStatementSyntax): void {
|
||||
this.visitToken(node.withKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
node.condition.accept(this);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitPrefixUnaryExpression(node: PrefixUnaryExpressionSyntax): void {
|
||||
this.visitToken(node.operatorToken);
|
||||
node.operand.accept(this);
|
||||
visitNodeOrToken(this, node.operand);
|
||||
}
|
||||
|
||||
public visitDeleteExpression(node: DeleteExpressionSyntax): void {
|
||||
this.visitToken(node.deleteKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitTypeOfExpression(node: TypeOfExpressionSyntax): void {
|
||||
this.visitToken(node.typeOfKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitVoidExpression(node: VoidExpressionSyntax): void {
|
||||
this.visitToken(node.voidKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitConditionalExpression(node: ConditionalExpressionSyntax): void {
|
||||
node.condition.accept(this);
|
||||
visitNodeOrToken(this, node.condition);
|
||||
this.visitToken(node.questionToken);
|
||||
node.whenTrue.accept(this);
|
||||
visitNodeOrToken(this, node.whenTrue);
|
||||
this.visitToken(node.colonToken);
|
||||
node.whenFalse.accept(this);
|
||||
visitNodeOrToken(this, node.whenFalse);
|
||||
}
|
||||
|
||||
public visitBinaryExpression(node: BinaryExpressionSyntax): void {
|
||||
node.left.accept(this);
|
||||
visitNodeOrToken(this, node.left);
|
||||
this.visitToken(node.operatorToken);
|
||||
node.right.accept(this);
|
||||
visitNodeOrToken(this, node.right);
|
||||
}
|
||||
|
||||
public visitPostfixUnaryExpression(node: PostfixUnaryExpressionSyntax): void {
|
||||
node.operand.accept(this);
|
||||
visitNodeOrToken(this, node.operand);
|
||||
this.visitToken(node.operatorToken);
|
||||
}
|
||||
|
||||
public visitMemberAccessExpression(node: MemberAccessExpressionSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.dotToken);
|
||||
this.visitToken(node.name);
|
||||
}
|
||||
|
||||
public visitInvocationExpression(node: InvocationExpressionSyntax): void {
|
||||
node.expression.accept(this);
|
||||
node.argumentList.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
visitNodeOrToken(this, node.argumentList);
|
||||
}
|
||||
|
||||
public visitArrayLiteralExpression(node: ArrayLiteralExpressionSyntax): void {
|
||||
@@ -428,49 +419,49 @@ module TypeScript {
|
||||
|
||||
public visitObjectCreationExpression(node: ObjectCreationExpressionSyntax): void {
|
||||
this.visitToken(node.newKeyword);
|
||||
node.expression.accept(this);
|
||||
this.visitOptionalNode(node.argumentList);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
visitNodeOrToken(this, node.argumentList);
|
||||
}
|
||||
|
||||
public visitParenthesizedExpression(node: ParenthesizedExpressionSyntax): void {
|
||||
this.visitToken(node.openParenToken);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.closeParenToken);
|
||||
}
|
||||
|
||||
public visitParenthesizedArrowFunctionExpression(node: ParenthesizedArrowFunctionExpressionSyntax): void {
|
||||
node.callSignature.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
this.visitOptionalNode(node.block);
|
||||
visitNodeOrToken(this, node.block);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitSimpleArrowFunctionExpression(node: SimpleArrowFunctionExpressionSyntax): void {
|
||||
node.parameter.accept(this);
|
||||
visitNodeOrToken(this, node.parameter);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
this.visitOptionalNode(node.block);
|
||||
visitNodeOrToken(this, node.block);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitCastExpression(node: CastExpressionSyntax): void {
|
||||
this.visitToken(node.lessThanToken);
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.visitToken(node.greaterThanToken);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitElementAccessExpression(node: ElementAccessExpressionSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.openBracketToken);
|
||||
node.argumentExpression.accept(this);
|
||||
visitNodeOrToken(this, node.argumentExpression);
|
||||
this.visitToken(node.closeBracketToken);
|
||||
}
|
||||
|
||||
public visitFunctionExpression(node: FunctionExpressionSyntax): void {
|
||||
this.visitToken(node.functionKeyword);
|
||||
this.visitOptionalToken(node.identifier);
|
||||
node.callSignature.accept(this);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitOmittedExpression(node: OmittedExpressionSyntax): void {
|
||||
@@ -482,8 +473,8 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitTemplateAccessExpression(node: TemplateAccessExpressionSyntax): void {
|
||||
node.expression.accept(this);
|
||||
node.templateExpression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
visitNodeOrToken(this, node.templateExpression);
|
||||
}
|
||||
|
||||
public visitVariableDeclaration(node: VariableDeclarationSyntax): void {
|
||||
@@ -493,12 +484,12 @@ module TypeScript {
|
||||
|
||||
public visitVariableDeclarator(node: VariableDeclaratorSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
this.visitOptionalNode(node.equalsValueClause);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.equalsValueClause);
|
||||
}
|
||||
|
||||
public visitArgumentList(node: ArgumentListSyntax): void {
|
||||
this.visitOptionalNode(node.typeArgumentList);
|
||||
visitNodeOrToken(this, node.typeArgumentList);
|
||||
this.visitToken(node.openParenToken);
|
||||
this.visitList(node.arguments);
|
||||
this.visitToken(node.closeParenToken);
|
||||
@@ -529,12 +520,12 @@ module TypeScript {
|
||||
|
||||
public visitEqualsValueClause(node: EqualsValueClauseSyntax): void {
|
||||
this.visitToken(node.equalsToken);
|
||||
node.value.accept(this);
|
||||
visitNodeOrToken(this, node.value);
|
||||
}
|
||||
|
||||
public visitCaseSwitchClause(node: CaseSwitchClauseSyntax): void {
|
||||
this.visitToken(node.caseKeyword);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.colonToken);
|
||||
this.visitList(node.statements);
|
||||
}
|
||||
@@ -547,48 +538,48 @@ module TypeScript {
|
||||
|
||||
public visitElseClause(node: ElseClauseSyntax): void {
|
||||
this.visitToken(node.elseKeyword);
|
||||
node.statement.accept(this);
|
||||
visitNodeOrToken(this, node.statement);
|
||||
}
|
||||
|
||||
public visitCatchClause(node: CatchClauseSyntax): void {
|
||||
this.visitToken(node.catchKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
this.visitToken(node.closeParenToken);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitFinallyClause(node: FinallyClauseSyntax): void {
|
||||
this.visitToken(node.finallyKeyword);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitTemplateClause(node: TemplateClauseSyntax): void {
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.templateMiddleOrEndToken);
|
||||
}
|
||||
|
||||
public visitTypeParameter(node: TypeParameterSyntax): void {
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalNode(node.constraint);
|
||||
visitNodeOrToken(this, node.constraint);
|
||||
}
|
||||
|
||||
public visitConstraint(node: ConstraintSyntax): void {
|
||||
this.visitToken(node.extendsKeyword);
|
||||
node.typeOrExpression.accept(this);
|
||||
visitNodeOrToken(this, node.typeOrExpression);
|
||||
}
|
||||
|
||||
public visitSimplePropertyAssignment(node: SimplePropertyAssignmentSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
this.visitToken(node.colonToken);
|
||||
node.expression.accept(this);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitFunctionPropertyAssignment(node: FunctionPropertyAssignmentSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
node.callSignature.accept(this);
|
||||
node.block.accept(this);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
}
|
||||
|
||||
public visitParameter(node: ParameterSyntax): void {
|
||||
@@ -596,18 +587,18 @@ module TypeScript {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalToken(node.questionToken);
|
||||
this.visitOptionalNode(node.typeAnnotation);
|
||||
this.visitOptionalNode(node.equalsValueClause);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
visitNodeOrToken(this, node.equalsValueClause);
|
||||
}
|
||||
|
||||
public visitEnumElement(node: EnumElementSyntax): void {
|
||||
this.visitToken(node.propertyName);
|
||||
this.visitOptionalNode(node.equalsValueClause);
|
||||
visitNodeOrToken(this, node.equalsValueClause);
|
||||
}
|
||||
|
||||
public visitTypeAnnotation(node: TypeAnnotationSyntax): void {
|
||||
this.visitToken(node.colonToken);
|
||||
node.type.accept(this);
|
||||
visitNodeOrToken(this, node.type);
|
||||
}
|
||||
|
||||
public visitExternalModuleReference(node: ExternalModuleReferenceSyntax): void {
|
||||
@@ -618,7 +609,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitModuleNameModuleReference(node: ModuleNameModuleReferenceSyntax): void {
|
||||
node.moduleName.accept(this);
|
||||
visitNodeOrToken(this, node.moduleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user