/NRefactory/ICSharpCode.NRefactory.VB/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
http://github.com/icsharpcode/ILSpy · C# · 3023 lines · 13 code · 3 blank · 3007 comment · 0 complexity · e098561aafdc0914575cd1308fe85882 MD5 · raw file
Large files are truncated click here to view the full file
- // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
- // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
- using System;
- using System.Linq;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Globalization;
- using System.Text;
- using ICSharpCode.NRefactory.VB.Ast;
- using ICSharpCode.NRefactory.VB.Parser;
- using ICSharpCode.NRefactory.VB.Visitors;
- namespace ICSharpCode.NRefactory.VB.PrettyPrinter
- {
- // public sealed class VBNetOutputVisitor : NodeTrackingAstVisitor, IOutputDomVisitor
- // {
- // Errors errors = new Errors();
- // VBNetOutputFormatter outputFormatter;
- // VBNetPrettyPrintOptions prettyPrintOptions = new VBNetPrettyPrintOptions();
- // TypeDeclaration currentType;
- //
- // Stack<int> exitTokenStack = new Stack<int>();
- //
- // public string Text {
- // get {
- // return outputFormatter.Text;
- // }
- // }
- //
- // public Errors Errors {
- // get {
- // return errors;
- // }
- // }
- //
- // AbstractPrettyPrintOptions IOutputDomVisitor.Options {
- // get { return prettyPrintOptions; }
- // }
- //
- // public VBNetPrettyPrintOptions Options {
- // get { return prettyPrintOptions; }
- // }
- //
- // public IOutputFormatter OutputFormatter {
- // get {
- // return outputFormatter;
- // }
- // }
- //
- // public VBNetOutputVisitor()
- // {
- // outputFormatter = new VBNetOutputFormatter(prettyPrintOptions);
- // }
- //
- // public event Action<INode> BeforeNodeVisit;
- // public event Action<INode> AfterNodeVisit;
- //
- // protected override void BeginVisit(INode node)
- // {
- // if (BeforeNodeVisit != null) {
- // BeforeNodeVisit(node);
- // }
- // base.BeginVisit(node);
- // }
- //
- // protected override void EndVisit(INode node)
- // {
- // base.EndVisit(node);
- // if (AfterNodeVisit != null) {
- // AfterNodeVisit(node);
- // }
- // }
- //
- // object TrackedVisit(INode node, object data)
- // {
- // return node.AcceptVisitor(this, data);
- // }
- //
- // void Error(string text, Location position)
- // {
- // errors.Error(position.Line, position.Column, text);
- // }
- //
- // void UnsupportedNode(INode node)
- // {
- // Error(node.GetType().Name + " is unsupported", node.StartLocation);
- // }
- //
- // #region ICSharpCode.NRefactory.Parser.IAstVisitor interface implementation
- // public override object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data)
- // {
- // compilationUnit.AcceptChildren(this, data);
- // outputFormatter.EndFile();
- // return null;
- // }
- //
- // /// <summary>
- // /// Converts type name to primitive type name. Returns typeString if typeString is not
- // /// a primitive type.
- // /// </summary>
- // static string ConvertTypeString(string typeString)
- // {
- // string primitiveType;
- // if (TypeReference.PrimitiveTypesVBReverse.TryGetValue(typeString, out primitiveType))
- // return primitiveType;
- // else
- // return typeString;
- // }
- //
- // public override object TrackedVisitTypeReference(TypeReference typeReference, object data)
- // {
- // if (typeReference == TypeReference.ClassConstraint) {
- // outputFormatter.PrintToken(Tokens.Class);
- // } else if (typeReference == TypeReference.StructConstraint) {
- // outputFormatter.PrintToken(Tokens.Structure);
- // } else if (typeReference == TypeReference.NewConstraint) {
- // outputFormatter.PrintToken(Tokens.New);
- // } else {
- // PrintTypeReferenceWithoutArray(typeReference);
- // if (typeReference.IsArrayType) {
- // PrintArrayRank(typeReference.RankSpecifier, 0);
- // }
- // }
- // return null;
- // }
- //
- // void PrintTypeReferenceWithoutArray(TypeReference typeReference)
- // {
- // if (typeReference.IsGlobal) {
- // outputFormatter.PrintToken(Tokens.Global);
- // outputFormatter.PrintToken(Tokens.Dot);
- // }
- // bool printGenerics = true;
- // if (typeReference.IsKeyword) {
- // outputFormatter.PrintText(ConvertTypeString(typeReference.Type));
- // } else {
- // outputFormatter.PrintIdentifier(typeReference.Type);
- // }
- // if (printGenerics && typeReference.GenericTypes != null && typeReference.GenericTypes.Count > 0) {
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // outputFormatter.PrintToken(Tokens.Of);
- // outputFormatter.Space();
- // AppendCommaSeparatedList(typeReference.GenericTypes);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // }
- // for (int i = 0; i < typeReference.PointerNestingLevel; ++i) {
- // outputFormatter.PrintToken(Tokens.Times);
- // }
- // }
- //
- // void PrintArrayRank(int[] rankSpecifier, int startRank)
- // {
- // for (int i = startRank; i < rankSpecifier.Length; ++i) {
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // for (int j = 0; j < rankSpecifier[i]; ++j) {
- // outputFormatter.PrintToken(Tokens.Comma);
- // }
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // }
- // }
- //
- // public override object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
- // {
- // TrackedVisit(innerClassTypeReference.BaseType, data);
- // outputFormatter.PrintToken(Tokens.Dot);
- // return VisitTypeReference((TypeReference)innerClassTypeReference, data);
- // }
- //
- // #region Global scope
- // bool printAttributeSectionInline; // is set to true when printing parameter's attributes
- //
- // public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
- // {
- // if (!printAttributeSectionInline)
- // outputFormatter.Indent();
- // outputFormatter.PrintText("<");
- // if (!string.IsNullOrEmpty(attributeSection.AttributeTarget) && !string.Equals(attributeSection.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase)) {
- // outputFormatter.PrintText(char.ToUpperInvariant(attributeSection.AttributeTarget[0]) + attributeSection.AttributeTarget.Substring(1));
- // outputFormatter.PrintToken(Tokens.Colon);
- // outputFormatter.Space();
- // }
- // Debug.Assert(attributeSection.Attributes != null);
- // AppendCommaSeparatedList(attributeSection.Attributes);
- //
- // outputFormatter.PrintText(">");
- //
- // if ("assembly".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)
- // || "module".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)) {
- // outputFormatter.NewLine();
- // } else {
- // if (printAttributeSectionInline)
- // outputFormatter.Space();
- // else
- // outputFormatter.PrintLineContinuation();
- // }
- //
- // return null;
- // }
- //
- // public override object TrackedVisitAttribute(ICSharpCode.NRefactory.VB.Ast.Attribute attribute, object data)
- // {
- // outputFormatter.PrintIdentifier(attribute.Type);
- // if (attribute.PositionalArguments.Count > 0 || attribute.NamedArguments.Count > 0) {
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(attribute.PositionalArguments);
- //
- // if (attribute.NamedArguments.Count > 0) {
- // if (attribute.PositionalArguments.Count > 0) {
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // }
- // AppendCommaSeparatedList(attribute.NamedArguments);
- // }
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data)
- // {
- // outputFormatter.PrintIdentifier(namedArgumentExpression.Name);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Colon);
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(namedArgumentExpression.Expression, data);
- // return null;
- // }
- //
- // public override object TrackedVisitUsing(ImportsClause @using, object data)
- // {
- // Debug.Fail("Should never be called. The usings should be handled in Visit(UsingDeclaration)");
- // return null;
- // }
- //
- // public override object TrackedVisitUsingDeclaration(ImportsStatement usingDeclaration, object data)
- // {
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.Imports);
- // outputFormatter.Space();
- // for (int i = 0; i < usingDeclaration.ImportsClauses.Count; ++i) {
- // outputFormatter.PrintIdentifier(((ImportsClause)usingDeclaration.ImportsClauses[i]).Name);
- // if (((ImportsClause)usingDeclaration.ImportsClauses[i]).IsAlias) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(((ImportsClause)usingDeclaration.ImportsClauses[i]).Alias, data);
- // }
- // if (i + 1 < usingDeclaration.ImportsClauses.Count) {
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // }
- // }
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
- // {
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.Namespace);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(namespaceDeclaration.Name);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // namespaceDeclaration.AcceptChildren(this, data);
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Namespace);
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // static int GetTypeToken(TypeDeclaration typeDeclaration)
- // {
- // switch (typeDeclaration.Type) {
- // case ClassType.Class:
- // return Tokens.Class;
- // case ClassType.Enum:
- // return Tokens.Enum;
- // case ClassType.Interface:
- // return Tokens.Interface;
- // case ClassType.Struct:
- // return Tokens.Structure;
- // case ClassType.Module:
- // return Tokens.Module;
- // default:
- // return Tokens.Class;
- // }
- // }
- //
- // void PrintTemplates(List<TemplateDefinition> templates)
- // {
- // if (templates != null && templates.Count > 0) {
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // outputFormatter.PrintToken(Tokens.Of);
- // outputFormatter.Space();
- // AppendCommaSeparatedList(templates);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // }
- // }
- //
- // public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- // {
- // VisitAttributes(typeDeclaration.Attributes, data);
- //
- // outputFormatter.Indent();
- // OutputModifier(typeDeclaration.Modifier, true, false);
- //
- // int typeToken = GetTypeToken(typeDeclaration);
- // outputFormatter.PrintToken(typeToken);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(typeDeclaration.Name);
- //
- // PrintTemplates(typeDeclaration.Templates);
- //
- // if (typeDeclaration.Type == ClassType.Enum
- // && typeDeclaration.BaseTypes != null && typeDeclaration.BaseTypes.Count > 0)
- // {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
- // TrackedVisit(baseTypeRef, data);
- // }
- // }
- //
- // outputFormatter.NewLine();
- // ++outputFormatter.IndentationLevel;
- //
- // if (typeDeclaration.BaseTypes != null && typeDeclaration.Type != ClassType.Enum) {
- // foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
- // outputFormatter.Indent();
- //
- // string baseType = baseTypeRef.Type;
- // if (baseType.IndexOf('.') >= 0) {
- // baseType = baseType.Substring(baseType.LastIndexOf('.') + 1);
- // }
- // bool baseTypeIsInterface = baseType.Length >= 2 && baseType[0] == 'I' && Char.IsUpper(baseType[1]);
- //
- // if (!baseTypeIsInterface || typeDeclaration.Type == ClassType.Interface) {
- // outputFormatter.PrintToken(Tokens.Inherits);
- // } else {
- // outputFormatter.PrintToken(Tokens.Implements);
- // }
- // outputFormatter.Space();
- // TrackedVisit(baseTypeRef, data);
- // outputFormatter.NewLine();
- // }
- // }
- //
- // TypeDeclaration oldType = currentType;
- // currentType = typeDeclaration;
- //
- // if (typeDeclaration.Type == ClassType.Enum) {
- // OutputEnumMembers(typeDeclaration, data);
- // } else {
- // typeDeclaration.AcceptChildren(this, data);
- // }
- // currentType = oldType;
- //
- // --outputFormatter.IndentationLevel;
- //
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(typeToken);
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // void OutputEnumMembers(TypeDeclaration typeDeclaration, object data)
- // {
- // foreach (FieldDeclaration fieldDeclaration in typeDeclaration.Children) {
- // BeginVisit(fieldDeclaration);
- // VariableDeclaration f = (VariableDeclaration)fieldDeclaration.Fields[0];
- // VisitAttributes(fieldDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // outputFormatter.PrintIdentifier(f.Name);
- // if (f.Initializer != null && !f.Initializer.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(f.Initializer, data);
- // }
- // outputFormatter.NewLine();
- // EndVisit(fieldDeclaration);
- // }
- // }
- //
- // public override object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data)
- // {
- // VisitAttributes(templateDefinition.Attributes, data);
- // switch (templateDefinition.VarianceModifier) {
- // case VarianceModifier.Invariant:
- // // nothing
- // break;
- // case VarianceModifier.Covariant:
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Out);
- // outputFormatter.Space();
- // break;
- // case VarianceModifier.Contravariant:
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.In);
- // outputFormatter.Space();
- // break;
- // default:
- // throw new Exception("Invalid value for VarianceModifier");
- // }
- // outputFormatter.PrintIdentifier(templateDefinition.Name);
- // if (templateDefinition.Bases.Count > 0) {
- // outputFormatter.PrintText(" As ");
- // VisitReturnTypeAttributes(templateDefinition.Attributes, data);
- // if (templateDefinition.Bases.Count == 1) {
- // TrackedVisit(templateDefinition.Bases[0], data);
- // } else {
- // outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- // AppendCommaSeparatedList(templateDefinition.Bases);
- // outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- // }
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- // {
- // VisitAttributes(delegateDeclaration.Attributes, data);
- //
- // outputFormatter.Indent();
- // OutputModifier(delegateDeclaration.Modifier, true, false);
- // outputFormatter.PrintToken(Tokens.Delegate);
- // outputFormatter.Space();
- //
- // bool isFunction = (delegateDeclaration.ReturnType.Type != "System.Void");
- // if (isFunction) {
- // outputFormatter.PrintToken(Tokens.Function);
- // outputFormatter.Space();
- // } else {
- // outputFormatter.PrintToken(Tokens.Sub);
- // outputFormatter.Space();
- // }
- // outputFormatter.PrintIdentifier(delegateDeclaration.Name);
- //
- // PrintTemplates(delegateDeclaration.Templates);
- //
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(delegateDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- //
- // if (isFunction) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(delegateDeclaration.Attributes, data);
- // TrackedVisit(delegateDeclaration.ReturnType, data);
- // }
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
- // {
- // outputFormatter.PrintToken(Tokens.Option);
- // outputFormatter.Space();
- // switch (optionDeclaration.OptionType) {
- // case OptionType.Strict:
- // outputFormatter.PrintToken(Tokens.Strict);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(optionDeclaration.OptionValue ? Tokens.On : Tokens.Off);
- // break;
- // case OptionType.Explicit:
- // outputFormatter.PrintToken(Tokens.Explicit);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(optionDeclaration.OptionValue ? Tokens.On : Tokens.Off);
- // break;
- // case OptionType.Infer:
- // outputFormatter.PrintToken(Tokens.Infer);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(optionDeclaration.OptionValue ? Tokens.On : Tokens.Off);
- // break;
- // case OptionType.CompareBinary:
- // outputFormatter.PrintToken(Tokens.Compare);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Binary);
- // break;
- // case OptionType.CompareText:
- // outputFormatter.PrintToken(Tokens.Compare);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Text);
- // break;
- // }
- // outputFormatter.NewLine();
- // return null;
- // }
- // #endregion
- //
- // #region Type level
- // TypeReference currentVariableType;
- // public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
- // {
- //
- // VisitAttributes(fieldDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // if (fieldDeclaration.Modifier == Modifiers.None) {
- // outputFormatter.PrintToken(Tokens.Private);
- // outputFormatter.Space();
- // } else {
- // OutputModifier(fieldDeclaration.Modifier, false, true);
- // }
- // currentVariableType = fieldDeclaration.TypeReference;
- // AppendCommaSeparatedList(fieldDeclaration.Fields);
- // currentVariableType = null;
- //
- // outputFormatter.NewLine();
- //
- // return null;
- // }
- //
- // public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- // {
- // outputFormatter.PrintIdentifier(variableDeclaration.Name);
- //
- // TypeReference varType = currentVariableType;
- // if (varType != null && varType.IsNull)
- // varType = null;
- // if (varType == null && !variableDeclaration.TypeReference.IsNull)
- // varType = variableDeclaration.TypeReference;
- //
- // if (varType != null) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // ObjectCreateExpression init = variableDeclaration.Initializer as ObjectCreateExpression;
- // if (init != null && TypeReference.AreEqualReferences(init.CreateType, varType)) {
- // TrackedVisit(variableDeclaration.Initializer, data);
- // return null;
- // } else {
- // TrackedVisit(varType, data);
- // }
- // }
- //
- // if (!variableDeclaration.Initializer.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(variableDeclaration.Initializer, data);
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- // {
- // VisitAttributes(propertyDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(propertyDeclaration.Modifier);
- //
- // if ((propertyDeclaration.Modifier & (Modifiers.ReadOnly | Modifiers.WriteOnly)) == Modifiers.None) {
- // if (propertyDeclaration.IsReadOnly) {
- // outputFormatter.PrintToken(Tokens.ReadOnly);
- // outputFormatter.Space();
- // } else if (propertyDeclaration.IsWriteOnly) {
- // outputFormatter.PrintToken(Tokens.WriteOnly);
- // outputFormatter.Space();
- // }
- // }
- //
- // outputFormatter.PrintToken(Tokens.Property);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(propertyDeclaration.Name);
- //
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(propertyDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- //
- // if (!propertyDeclaration.TypeReference.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- //
- // VisitReturnTypeAttributes(propertyDeclaration.Attributes, data);
- //
- // ObjectCreateExpression init = propertyDeclaration.Initializer as ObjectCreateExpression;
- // if (init != null && TypeReference.AreEqualReferences(init.CreateType, propertyDeclaration.TypeReference)) {
- // TrackedVisit(propertyDeclaration.Initializer, data);
- // } else {
- // TrackedVisit(propertyDeclaration.TypeReference, data);
- // }
- // }
- //
- // PrintInterfaceImplementations(propertyDeclaration.InterfaceImplementations);
- //
- // if (!propertyDeclaration.Initializer.IsNull && !(propertyDeclaration.Initializer is ObjectCreateExpression)) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(propertyDeclaration.Initializer, data);
- // }
- //
- // outputFormatter.NewLine();
- //
- // if (!IsAbstract(propertyDeclaration) && (propertyDeclaration.GetRegion.Block != NullBlockStatement.Instance || propertyDeclaration.SetRegion.Block != NullBlockStatement.Instance)) {
- // outputFormatter.IsInMemberBody = true;
- // ++outputFormatter.IndentationLevel;
- // exitTokenStack.Push(Tokens.Property);
- // TrackedVisit(propertyDeclaration.GetRegion, data);
- // TrackedVisit(propertyDeclaration.SetRegion, data);
- // exitTokenStack.Pop();
- // --outputFormatter.IndentationLevel;
- // outputFormatter.IsInMemberBody = false;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Property);
- // outputFormatter.NewLine();
- // }
- //
- // return null;
- // }
- //
- // public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data)
- // {
- // VisitAttributes(propertyGetRegion.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(propertyGetRegion.Modifier);
- // outputFormatter.PrintToken(Tokens.Get);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(propertyGetRegion.Block, data);
- // --outputFormatter.IndentationLevel;
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Get);
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
- // {
- // VisitAttributes(propertySetRegion.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(propertySetRegion.Modifier);
- // outputFormatter.PrintToken(Tokens.Set);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(propertySetRegion.Block, data);
- // --outputFormatter.IndentationLevel;
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Set);
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // TypeReference currentEventType = null;
- // public override object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- // {
- // bool customEvent = eventDeclaration.HasAddRegion || eventDeclaration.HasRemoveRegion;
- //
- // VisitAttributes(eventDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(eventDeclaration.Modifier);
- // if (customEvent) {
- // outputFormatter.PrintText("Custom");
- // outputFormatter.Space();
- // }
- //
- // outputFormatter.PrintToken(Tokens.Event);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(eventDeclaration.Name);
- //
- // if (eventDeclaration.Parameters.Count > 0) {
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // this.AppendCommaSeparatedList(eventDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // }
- // if (!eventDeclaration.TypeReference.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(eventDeclaration.Attributes, data);
- // TrackedVisit(eventDeclaration.TypeReference, data);
- // }
- //
- // PrintInterfaceImplementations(eventDeclaration.InterfaceImplementations);
- //
- // if (!eventDeclaration.Initializer.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(eventDeclaration.Initializer, data);
- // }
- //
- // outputFormatter.NewLine();
- //
- // if (customEvent) {
- // ++outputFormatter.IndentationLevel;
- // currentEventType = eventDeclaration.TypeReference;
- // exitTokenStack.Push(Tokens.Sub);
- // TrackedVisit(eventDeclaration.AddRegion, data);
- // TrackedVisit(eventDeclaration.RemoveRegion, data);
- // exitTokenStack.Pop();
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Event);
- // outputFormatter.NewLine();
- // }
- // return null;
- // }
- //
- // void PrintInterfaceImplementations(IList<InterfaceImplementation> list)
- // {
- // if (list == null || list.Count == 0)
- // return;
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Implements);
- // for (int i = 0; i < list.Count; i++) {
- // if (i > 0)
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // TrackedVisit(list[i].InterfaceType, null);
- // outputFormatter.PrintToken(Tokens.Dot);
- // outputFormatter.PrintIdentifier(list[i].MemberName);
- // }
- // }
- //
- // public override object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data)
- // {
- // VisitAttributes(eventAddRegion.Attributes, data);
- // outputFormatter.Indent();
- // outputFormatter.PrintText("AddHandler(");
- // if (eventAddRegion.Parameters.Count == 0) {
- // outputFormatter.PrintToken(Tokens.ByVal);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier("value");
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // TrackedVisit(currentEventType, data);
- // } else {
- // this.AppendCommaSeparatedList(eventAddRegion.Parameters);
- // }
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(eventAddRegion.Block, data);
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintText("AddHandler");
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data)
- // {
- // VisitAttributes(eventRemoveRegion.Attributes, data);
- // outputFormatter.Indent();
- // outputFormatter.PrintText("RemoveHandler");
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // if (eventRemoveRegion.Parameters.Count == 0) {
- // outputFormatter.PrintToken(Tokens.ByVal);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier("value");
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // TrackedVisit(currentEventType, data);
- // } else {
- // this.AppendCommaSeparatedList(eventRemoveRegion.Parameters);
- // }
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(eventRemoveRegion.Block, data);
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintText("RemoveHandler");
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data)
- // {
- // VisitAttributes(eventRaiseRegion.Attributes, data);
- // outputFormatter.Indent();
- // outputFormatter.PrintText("RaiseEvent");
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // if (eventRaiseRegion.Parameters.Count == 0) {
- // outputFormatter.PrintToken(Tokens.ByVal);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier("value");
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // TrackedVisit(currentEventType, data);
- // } else {
- // this.AppendCommaSeparatedList(eventRaiseRegion.Parameters);
- // }
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(eventRaiseRegion.Block, data);
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintText("RaiseEvent");
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- // {
- // printAttributeSectionInline = true;
- // VisitAttributes(parameterDeclarationExpression.Attributes, data);
- // printAttributeSectionInline = false;
- // OutputModifier(parameterDeclarationExpression.ParamModifier);
- // outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName);
- // if (!parameterDeclarationExpression.TypeReference.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(parameterDeclarationExpression.Attributes, data);
- // TrackedVisit(parameterDeclarationExpression.TypeReference, data);
- // }
- // if (!parameterDeclarationExpression.DefaultValue.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Assign);
- // outputFormatter.Space();
- // TrackedVisit(parameterDeclarationExpression.DefaultValue, data);
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- // {
- // VisitAttributes(methodDeclaration.Attributes, data);
- // if (methodDeclaration.IsExtensionMethod) {
- // outputFormatter.Indent();
- // outputFormatter.PrintText("<System.Runtime.CompilerServices.Extension> _");
- // outputFormatter.NewLine();
- // }
- // outputFormatter.Indent();
- // OutputModifier(methodDeclaration.Modifier);
- //
- // bool isSub = methodDeclaration.TypeReference.IsNull ||
- // methodDeclaration.TypeReference.Type == "System.Void";
- //
- // if (isSub) {
- // outputFormatter.PrintToken(Tokens.Sub);
- // } else {
- // outputFormatter.PrintToken(Tokens.Function);
- // }
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(methodDeclaration.Name);
- //
- // PrintTemplates(methodDeclaration.Templates);
- //
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(methodDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- //
- // if (!isSub) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(methodDeclaration.Attributes, data);
- // TrackedVisit(methodDeclaration.TypeReference, data);
- // }
- //
- // PrintInterfaceImplementations(methodDeclaration.InterfaceImplementations);
- //
- // if (methodDeclaration.HandlesClause.Count > 0) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Handles);
- // for (int i = 0; i < methodDeclaration.HandlesClause.Count; i++) {
- // if (i > 0)
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // outputFormatter.PrintText(methodDeclaration.HandlesClause[i]);
- // }
- // }
- //
- // outputFormatter.NewLine();
- //
- // if (!IsAbstract(methodDeclaration)) {
- // outputFormatter.IsInMemberBody = true;
- // BeginVisit(methodDeclaration.Body);
- // ++outputFormatter.IndentationLevel;
- // exitTokenStack.Push(isSub ? Tokens.Sub : Tokens.Function);
- // // we're doing the tracking manually using BeginVisit/EndVisit, so call Tracked... directly
- // this.TrackedVisitBlockStatement(methodDeclaration.Body, data);
- // exitTokenStack.Pop();
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // if (isSub) {
- // outputFormatter.PrintToken(Tokens.Sub);
- // } else {
- // outputFormatter.PrintToken(Tokens.Function);
- // }
- // outputFormatter.NewLine();
- // EndVisit(methodDeclaration.Body);
- // outputFormatter.IsInMemberBody = false;
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data)
- // {
- // throw new InvalidOperationException();
- // }
- //
- // bool IsAbstract(AttributedNode node)
- // {
- // if ((node.Modifier & Modifiers.Abstract) == Modifiers.Abstract)
- // return true;
- // return currentType != null && currentType.Type == ClassType.Interface;
- // }
- //
- // public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- // {
- // VisitAttributes(constructorDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(constructorDeclaration.Modifier);
- // outputFormatter.PrintToken(Tokens.Sub);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.New);
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(constructorDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // outputFormatter.NewLine();
- //
- // outputFormatter.IsInMemberBody = true;
- // ++outputFormatter.IndentationLevel;
- // exitTokenStack.Push(Tokens.Sub);
- //
- // TrackedVisit(constructorDeclaration.ConstructorInitializer, data);
- //
- // TrackedVisit(constructorDeclaration.Body, data);
- // exitTokenStack.Pop();
- // --outputFormatter.IndentationLevel;
- // outputFormatter.IsInMemberBody = false;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Sub);
- // outputFormatter.NewLine();
- //
- // return null;
- // }
- //
- // public override object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data)
- // {
- // outputFormatter.Indent();
- // if (constructorInitializer.ConstructorInitializerType == ConstructorInitializerType.This) {
- // outputFormatter.PrintToken(Tokens.Me);
- // } else {
- // outputFormatter.PrintToken(Tokens.MyBase);
- // }
- // outputFormatter.PrintToken(Tokens.Dot);
- // outputFormatter.PrintToken(Tokens.New);
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(constructorInitializer.Arguments);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- //
- // outputFormatter.NewLine();
- // return null;
- // }
- //
- // public override object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data)
- // {
- // VisitAttributes(operatorDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(operatorDeclaration.Modifier);
- //
- // if (operatorDeclaration.IsConversionOperator) {
- // if (operatorDeclaration.ConversionType == ConversionType.Implicit) {
- // outputFormatter.PrintToken(Tokens.Widening);
- // } else {
- // outputFormatter.PrintToken(Tokens.Narrowing);
- // }
- // outputFormatter.Space();
- // }
- //
- // outputFormatter.PrintToken(Tokens.Operator);
- // outputFormatter.Space();
- //
- // int op = -1;
- //
- // switch(operatorDeclaration.OverloadableOperator)
- // {
- // case OverloadableOperatorType.Add:
- // case OverloadableOperatorType.UnaryPlus:
- // op = Tokens.Plus;
- // break;
- // case OverloadableOperatorType.UnaryMinus:
- // case OverloadableOperatorType.Subtract:
- // op = Tokens.Minus;
- // break;
- // case OverloadableOperatorType.Multiply:
- // op = Tokens.Times;
- // break;
- // case OverloadableOperatorType.Divide:
- // op = Tokens.Div;
- // break;
- // case OverloadableOperatorType.Modulus:
- // op = Tokens.Mod;
- // break;
- // case OverloadableOperatorType.Concat:
- // op = Tokens.ConcatString;
- // break;
- // case OverloadableOperatorType.Not:
- // op = Tokens.Not;
- // break;
- // case OverloadableOperatorType.BitNot:
- // op = Tokens.Not;
- // break;
- // case OverloadableOperatorType.BitwiseAnd:
- // op = Tokens.And;
- // break;
- // case OverloadableOperatorType.BitwiseOr:
- // op = Tokens.Or;
- // break;
- // case OverloadableOperatorType.ExclusiveOr:
- // op = Tokens.Xor;
- // break;
- // case OverloadableOperatorType.ShiftLeft:
- // op = Tokens.ShiftLeft;
- // break;
- // case OverloadableOperatorType.ShiftRight:
- // op = Tokens.ShiftRight;
- // break;
- // case OverloadableOperatorType.GreaterThan:
- // op = Tokens.GreaterThan;
- // break;
- // case OverloadableOperatorType.GreaterThanOrEqual:
- // op = Tokens.GreaterEqual;
- // break;
- // case OverloadableOperatorType.Equality:
- // op = Tokens.Assign;
- // break;
- // case OverloadableOperatorType.InEquality:
- // op = Tokens.NotEqual;
- // break;
- // case OverloadableOperatorType.LessThan:
- // op = Tokens.LessThan;
- // break;
- // case OverloadableOperatorType.LessThanOrEqual:
- // op = Tokens.LessEqual;
- // break;
- // case OverloadableOperatorType.Increment:
- // Error("Increment operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
- // break;
- // case OverloadableOperatorType.Decrement:
- // Error("Decrement operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
- // break;
- // case OverloadableOperatorType.IsTrue:
- // outputFormatter.PrintText("IsTrue");
- // break;
- // case OverloadableOperatorType.IsFalse:
- // outputFormatter.PrintText("IsFalse");
- // break;
- // case OverloadableOperatorType.Like:
- // op = Tokens.Like;
- // break;
- // case OverloadableOperatorType.Power:
- // op = Tokens.Power;
- // break;
- // case OverloadableOperatorType.CType:
- // op = Tokens.CType;
- // break;
- // case OverloadableOperatorType.DivideInteger:
- // op = Tokens.DivInteger;
- // break;
- // }
- //
- //
- //
- // if (operatorDeclaration.IsConversionOperator) {
- // outputFormatter.PrintToken(Tokens.CType);
- // } else {
- // if(op != -1) outputFormatter.PrintToken(op);
- // }
- //
- // PrintTemplates(operatorDeclaration.Templates);
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(operatorDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // if (!operatorDeclaration.TypeReference.IsNull) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(operatorDeclaration.Attributes, data);
- // TrackedVisit(operatorDeclaration.TypeReference, data);
- // }
- //
- // outputFormatter.NewLine();
- //
- // ++outputFormatter.IndentationLevel;
- // TrackedVisit(operatorDeclaration.Body, data);
- // --outputFormatter.IndentationLevel;
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Operator);
- // outputFormatter.NewLine();
- //
- // return null;
- // }
- //
- // public override object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
- // {
- // VisitAttributes(declareDeclaration.Attributes, data);
- // outputFormatter.Indent();
- // OutputModifier(declareDeclaration.Modifier);
- // outputFormatter.PrintToken(Tokens.Declare);
- // outputFormatter.Space();
- //
- // switch (declareDeclaration.Charset) {
- // case CharsetModifier.Auto:
- // outputFormatter.PrintToken(Tokens.Auto);
- // outputFormatter.Space();
- // break;
- // case CharsetModifier.Unicode:
- // outputFormatter.PrintToken(Tokens.Unicode);
- // outputFormatter.Space();
- // break;
- // case CharsetModifier.Ansi:
- // outputFormatter.PrintToken(Tokens.Ansi);
- // outputFormatter.Space();
- // break;
- // }
- //
- // bool isVoid = declareDeclaration.TypeReference.IsNull || declareDeclaration.TypeReference.Type == "System.Void";
- // if (isVoid) {
- // outputFormatter.PrintToken(Tokens.Sub);
- // } else {
- // outputFormatter.PrintToken(Tokens.Function);
- // }
- // outputFormatter.Space();
- //
- // outputFormatter.PrintIdentifier(declareDeclaration.Name);
- //
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Lib);
- // outputFormatter.Space();
- // outputFormatter.PrintText(ConvertString(declareDeclaration.Library));
- // outputFormatter.Space();
- //
- // if (declareDeclaration.Alias.Length > 0) {
- // outputFormatter.PrintToken(Tokens.Alias);
- // outputFormatter.Space();
- // outputFormatter.PrintText(ConvertString(declareDeclaration.Alias));
- // outputFormatter.Space();
- // }
- //
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(declareDeclaration.Parameters);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- //
- // if (!isVoid) {
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.As);
- // outputFormatter.Space();
- // VisitReturnTypeAttributes(declareDeclaration.Attributes, data);
- // TrackedVisit(declareDeclaration.TypeReference, data);
- // }
- //
- // outputFormatter.NewLine();
- //
- // return null;
- // }
- // #endregion
- //
- // #region Statements
- // public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data)
- // {
- // if (blockStatement.Parent is BlockStatement) {
- // outputFormatter.Indent();
- // outputFormatter.PrintText("If True Then");
- // outputFormatter.NewLine();
- // outputFormatter.IndentationLevel += 1;
- // }
- // VisitStatementList(blockStatement.Children);
- // if (blockStatement.Parent is BlockStatement) {
- // outputFormatter.IndentationLevel -= 1;
- // outputFormatter.Indent();
- // outputFormatter.PrintText("End If");
- // outputFormatter.NewLine();
- // }
- // return null;
- // }
- //
- // void PrintIndentedBlock(Statement stmt)
- // {
- // outputFormatter.IndentationLevel += 1;
- // if (stmt is BlockStatement) {
- // TrackedVisit(stmt, null);
- // } else {
- // outputFormatter.Indent();
- // TrackedVisit(stmt, null);
- // outputFormatter.NewLine();
- // }
- // outputFormatter.IndentationLevel -= 1;
- // }
- //
- // void PrintIndentedBlock(IEnumerable statements)
- // {
- // outputFormatter.IndentationLevel += 1;
- // VisitStatementList(statements);
- // outputFormatter.IndentationLevel -= 1;
- // }
- //
- // void VisitStatementList(IEnumerable statements)
- // {
- // foreach (Statement stmt in statements) {
- // if (stmt is BlockStatement) {
- // TrackedVisit(stmt, null);
- // } else {
- // outputFormatter.Indent();
- // TrackedVisit(stmt, null);
- // outputFormatter.NewLine();
- // }
- // }
- // }
- //
- // public override object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.AddHandler);
- // outputFormatter.Space();
- // TrackedVisit(addHandlerStatement.EventExpression, data);
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // TrackedVisit(addHandlerStatement.HandlerExpression, data);
- // return null;
- // }
- //
- // public override object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.RemoveHandler);
- // outputFormatter.Space();
- // TrackedVisit(removeHandlerStatement.EventExpression, data);
- // outputFormatter.PrintToken(Tokens.Comma);
- // outputFormatter.Space();
- // TrackedVisit(removeHandlerStatement.HandlerExpression, data);
- // return null;
- // }
- //
- // public override object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.RaiseEvent);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
- // outputFormatter.PrintToken(Tokens.OpenParenthesis);
- // AppendCommaSeparatedList(raiseEventStatement.Arguments);
- // outputFormatter.PrintToken(Tokens.CloseParenthesis);
- // return null;
- // }
- //
- // public override object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.Erase);
- // outputFormatter.Space();
- // AppendCommaSeparatedList(eraseStatement.Expressions);
- // return null;
- // }
- //
- // public override object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.Error);
- // outputFormatter.Space();
- // TrackedVisit(errorStatement.Expression, data);
- // return null;
- // }
- //
- // public override object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.On);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Error);
- // outputFormatter.Space();
- // TrackedVisit(onErrorStatement.EmbeddedStatement, data);
- // return null;
- // }
- //
- // public override object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.ReDim);
- // outputFormatter.Space();
- // if (reDimStatement.IsPreserve) {
- // outputFormatter.PrintToken(Tokens.Preserve);
- // outputFormatter.Space();
- // }
- //
- // AppendCommaSeparatedList(reDimStatement.ReDimClauses);
- // return null;
- // }
- //
- // public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- // {
- // TrackedVisit(expressionStatement.Expression, data);
- // return null;
- // }
- //
- // public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- // {
- // if (localVariableDeclaration.Modifier != Modifiers.None) {
- // OutputModifier(localVariableDeclaration.Modifier & ~Modifiers.Dim);
- // }
- // if (!isUsingResourceAcquisition) {
- // if ((localVariableDeclaration.Modifier & Modifiers.Const) == 0) {
- // outputFormatter.PrintToken(Tokens.Dim);
- // }
- // outputFormatter.Space();
- // }
- // currentVariableType = localVariableDeclaration.TypeReference;
- //
- // AppendCommaSeparatedList(localVariableDeclaration.Variables);
- // currentVariableType = null;
- //
- // return null;
- // }
- //
- // public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.Return);
- // if (!returnStatement.Expression.IsNull) {
- // outputFormatter.Space();
- // TrackedVisit(returnStatement.Expression, data);
- // }
- // return null;
- // }
- //
- // public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.If);
- // outputFormatter.Space();
- // TrackedVisit(ifElseStatement.Condition, data);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Then);
- // outputFormatter.NewLine();
- //
- // PrintIndentedBlock(ifElseStatement.TrueStatement);
- //
- // foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) {
- // TrackedVisit(elseIfSection, data);
- // }
- //
- // if (ifElseStatement.HasElseStatements) {
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.Else);
- // outputFormatter.NewLine();
- // PrintIndentedBlock(ifElseStatement.FalseStatement);
- // }
- //
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.End);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.If);
- // return null;
- // }
- //
- // public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
- // {
- // outputFormatter.Indent();
- // outputFormatter.PrintToken(Tokens.ElseIf);
- // outputFormatter.Space();
- // TrackedVisit(elseIfSection.Condition, data);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Then);
- // outputFormatter.NewLine();
- // PrintIndentedBlock(elseIfSection.EmbeddedStatement);
- // return null;
- // }
- //
- // public override object TrackedVisitLabelStatement(LabelStatement labelStatement, object data)
- // {
- // outputFormatter.PrintIdentifier(labelStatement.Label);
- // outputFormatter.PrintToken(Tokens.Colon);
- // return null;
- // }
- //
- // public override object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data)
- // {
- // outputFormatter.PrintToken(Tokens.GoTo);
- // outputFormatter.Space();
- // outputFormatter.PrintIdentifier(gotoStatement.Label);
- // return null;
- // }
- //
- // public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data)
- // {
- // exitTokenStack.Push(Tokens.Select);
- // outputFormatter.PrintToken(Tokens.Select);
- // outputFormatter.Space();
- // outputFormatter.PrintToken(Tokens.Case);
- // outputFormatter.Space();
- // TrackedVisit(switchStatement.SwitchExpression, data);
- // outputFormatter.NewLine();
- // ++outputFormatter.IndentationLevel;
- // foreach…