public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
        {
            // Initialize resolver for method:
            if (!methodDeclaration.Body.IsNull)
            {
                if (resolver.Initialize(parseInformation, methodDeclaration.Body.StartLocation.Y, methodDeclaration.Body.StartLocation.X))
                {
                    resolver.RunLookupTableVisitor(methodDeclaration);
                }
            }
            IMethod currentMethod = resolver.CallingMember as IMethod;

            CreateInterfaceImplementations(currentMethod, methodDeclaration, methodDeclaration.InterfaceImplementations);
            if (currentMethod != null && currentMethod.Name == "Main")
            {
                if (currentMethod.DeclaringType.FullyQualifiedName == StartupObjectToMakePublic)
                {
                    if (currentMethod.IsStatic && currentMethod.IsPrivate)
                    {
                        methodDeclaration.Modifier &= ~Modifiers.Private;
                        methodDeclaration.Modifier |= Modifiers.Internal;
                    }
                }
            }
            return(base.VisitMethodDeclaration(methodDeclaration, data));
        }
        public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            resolver.Initialize(parseInformation, typeDeclaration.BodyStartLocation.Line, typeDeclaration.BodyStartLocation.Column);

            if (resolver.CallingClass != null)
            {
                // add Partial modifier to all parts of the class
                IClass callingClass = resolver.CallingClass.GetCompoundClass();
                if (callingClass.IsPartial)
                {
                    typeDeclaration.Modifier |= Modifiers.Partial;
                }
                // determine if the type contains handles clauses referring to the current type
                bool containsClassHandlesClauses = false;
                bool hasConstructors             = false;
                foreach (IMethod method in callingClass.Methods)
                {
                    // do not count compiler-generated constructors
                    if (method.IsSynthetic)
                    {
                        continue;
                    }

                    hasConstructors |= method.IsConstructor;
                    foreach (string handles in method.HandlesClauses)
                    {
                        containsClassHandlesClauses |= !handles.Contains(".");
                    }
                }
                // ensure the type has at least one constructor to which the AddHandlerStatements can be added
                CompoundClass compoundClass = callingClass as CompoundClass;
                if (!hasConstructors)
                {
                    // add constructor only to one part
                    if (compoundClass == null || compoundClass.Parts[0] == resolver.CallingClass)
                    {
                        if (containsClassHandlesClauses || RequiresConstructor(callingClass))
                        {
                            AddDefaultConstructor(callingClass, typeDeclaration);
                        }
                    }
                }
            }

            base.VisitTypeDeclaration(typeDeclaration, data);
            return(null);
        }
        public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
        {
            // Initialize resolver for method:
            if (!methodDeclaration.Body.IsNull)
            {
                if (resolver.Initialize(parseInformation, methodDeclaration.Body.StartLocation.Y, methodDeclaration.Body.StartLocation.X))
                {
                    resolver.RunLookupTableVisitor(methodDeclaration);
                }
            }
            IMethod currentMethod = resolver.CallingMember as IMethod;

            CreateInterfaceImplementations(currentMethod, methodDeclaration, methodDeclaration.InterfaceImplementations);
            // Make "Main" public
            if (currentMethod != null && currentMethod.Name == "Main")
            {
                if (currentMethod.DeclaringType.FullyQualifiedName == StartupObjectToMakePublic)
                {
                    if (currentMethod.IsStatic && currentMethod.IsPrivate)
                    {
                        methodDeclaration.Modifier &= ~Modifiers.Private;
                        methodDeclaration.Modifier |= Modifiers.Internal;
                    }
                }
            }
            if (resolver.CallingClass != null && resolver.CallingClass.BaseType != null)
            {
                // methods with the same name as a method in a base class must have 'Overloads'
                if ((methodDeclaration.Modifier & (Modifiers.Override | Modifiers.New)) == Modifiers.None)
                {
                    if (resolver.CallingClass.BaseType.GetMethods()
                        .Any(m => string.Equals(m.Name, methodDeclaration.Name, StringComparison.OrdinalIgnoreCase)))
                    {
                        methodDeclaration.Modifier |= Modifiers.Overloads;
                    }
                }
            }
            return(base.VisitMethodDeclaration(methodDeclaration, data));
        }