public virtual object Visit(TypeDeclaration typeDeclaration, object data)
 {
     foreach (AttributeSection section in typeDeclaration.Attributes) {
         section.AcceptVisitor(this, data);
     }
     return typeDeclaration.AcceptChildren(this, data);
 }
        public override object Visit(TypeDeclaration typeDeclaration, object data)
        {
            ProcessSpecials(typeDeclaration.Specials);

            this.currentTypeDeclaration = typeDeclaration;
            CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(typeDeclaration.Name);
            codeTypeDeclaration.IsClass     = typeDeclaration.Type == Types.Class;
            codeTypeDeclaration.IsEnum      = typeDeclaration.Type == Types.Enum;
            codeTypeDeclaration.IsInterface = typeDeclaration.Type == Types.Interface;
            codeTypeDeclaration.IsStruct    = typeDeclaration.Type == Types.Struct;

            if (typeDeclaration.BaseTypes != null) {
                foreach (object o in typeDeclaration.BaseTypes) {
                    codeTypeDeclaration.BaseTypes.Add(new CodeTypeReference(o.ToString()));
                }
            }

            typeDeclarations.Push(codeTypeDeclaration);
            typeDeclaration.AcceptChildren(this,data);
            //			((INode)typeDeclaration.Children[0]).(this, data);

            typeDeclarations.Pop();

            ((CodeNamespace)namespaceDeclarations.Peek()).Types.Add(codeTypeDeclaration);

            return null;
        }
        public override object Visit(TypeDeclaration typeDeclaration, object data)
        {
            DebugOutput(typeDeclaration);
            AppendNewLine();
            generateAttributeUnderScore = true;
            AppendAttributes(typeDeclaration.Attributes);
            string modifier =  GetModifier(typeDeclaration.Modifier);
            string type = String.Empty;

            switch (typeDeclaration.Type) {
                case Types.Class:
                    type = "Class ";
                    break;
                case Types.Enum:
                    type = "Enum ";
                    break;
                case Types.Interface:
                    type = "Interface ";
                    break;
                case Types.Struct:
                    // this should be better in VBNetRefactory class because it is an AST transformation, but currently I'm too lazy
                    if (TypeHasOnlyStaticMembers(typeDeclaration)) {
                        goto case Types.Class;
                    }
                    type = "Structure ";
                    break;
            }
            AppendIndentation();sourceText.Append(modifier);
            sourceText.Append(type);
            sourceText.Append(typeDeclaration.Name);
            AppendNewLine();

            if (typeDeclaration.BaseTypes != null) {
                foreach (string baseType in typeDeclaration.BaseTypes) {
                    AppendIndentation();

                    bool baseTypeIsInterface = baseType.StartsWith("I") && (baseType.Length <= 1 || Char.IsUpper(baseType[1]));

                    if (!baseTypeIsInterface || typeDeclaration.Type == Types.Interface) {
                        sourceText.Append("Inherits ");
                    } else {
                        sourceText.Append("Implements ");
                    }
                    sourceText.Append(baseType);
                    AppendNewLine();
                }
            }

            ++indentLevel;
            TypeDeclaration oldType = currentType;
            currentType = typeDeclaration;
            typeDeclaration.AcceptChildren(this, data);
            currentType = oldType;
            --indentLevel;
            AppendIndentation();sourceText.Append("End ");
            sourceText.Append(type);
            AppendNewLine();
            generateAttributeUnderScore = false;
            return null;
        }
 public override object Visit(TypeDeclaration typeDeclaration, object data)
 {
     Console.WriteLine(typeDeclaration.ToString());
     return typeDeclaration.AcceptChildren(this, data);
 }
        public override object Visit(TypeDeclaration typeDeclaration, object data)
        {
            VisitAttributes(typeDeclaration.Attributes, data);
            outputFormatter.Indent();
            VisitModifier(typeDeclaration.Modifier);
            switch (typeDeclaration.Type) {
                case Types.Class:
                    outputFormatter.PrintToken(Tokens.Class);
                    break;
                case Types.Enum:
                    outputFormatter.PrintToken(Tokens.Enum);
                    break;
                case Types.Interface:
                    outputFormatter.PrintToken(Tokens.Interface);
                    break;
                case Types.Struct:
                    outputFormatter.PrintToken(Tokens.Struct);
                    break;
            }
            outputFormatter.Space();
            outputFormatter.PrintIdentifier(typeDeclaration.Name);
            if (typeDeclaration.BaseTypes != null && typeDeclaration.BaseTypes.Count > 0) {
                outputFormatter.Space();
                outputFormatter.PrintToken(Tokens.Colon);
                for (int i = 0; i < typeDeclaration.BaseTypes.Count; ++i) {
                    outputFormatter.Space();
                    outputFormatter.PrintIdentifier(typeDeclaration.BaseTypes[i]);
                    if (i + 1 < typeDeclaration.BaseTypes.Count) {
                        outputFormatter.PrintToken(Tokens.Comma);
                        outputFormatter.Space();
                    }
                }
            }

            switch (typeDeclaration.Type) {
                case Types.Class:
                    outputFormatter.BeginBrace(this.prettyPrintOptions.ClassBraceStyle);
                    break;
                case Types.Enum:
                    outputFormatter.BeginBrace(this.prettyPrintOptions.EnumBraceStyle);
                    break;
                case Types.Interface:
                    outputFormatter.BeginBrace(this.prettyPrintOptions.InterfaceBraceStyle);
                    break;
                case Types.Struct:
                    outputFormatter.BeginBrace(this.prettyPrintOptions.StructBraceStyle);
                    break;
            }

            if (typeDeclaration.Type == Types.Enum) {
                VisitEnumMembers(typeDeclaration, data);
            } else {
                typeDeclaration.AcceptChildren(this, data);
            }
            outputFormatter.EndBrace();

            return null;
        }