Exemple #1
0
        public static bool IsEntryPointMethod(IEmitter emitter, MethodDeclaration methodDeclaration)
        {
            var member_rr = emitter.Resolver.ResolveNode(methodDeclaration, emitter) as MemberResolveResult;
            var method    = member_rr != null ? member_rr.Member : null;

            if (method != null && method.Name == CS.Methods.AUTO_STARTUP_METHOD_NAME &&
                method.IsStatic &&
                !method.IsAbstract &&
                Helpers.IsEntryPointCandidate(emitter, methodDeclaration))
            {
                bool isReady = false;
                foreach (var attr in method.Attributes)
                {
                    if (attr.AttributeType.FullName == CS.Attributes.READY_ATTRIBUTE_NAME)
                    {
                        isReady = true;
                        break;
                    }
                }

                if (!isReady)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        public static bool IsEntryPointMethod(IMethod method)
        {
            if (method != null && method.Name == CS.Methods.AUTO_STARTUP_METHOD_NAME &&
                method.IsStatic &&
                !method.IsAbstract &&
                Helpers.IsEntryPointCandidate(method))
            {
                bool isReady = false;
                foreach (var attr in method.Attributes)
                {
                    if (attr.AttributeType.FullName == CS.Attributes.READY_ATTRIBUTE_NAME)
                    {
                        isReady = true;
                        break;
                    }
                }

                if (!isReady)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        public static bool IsEntryPointCandidate(IEmitter emitter, MethodDeclaration methodDeclaration)
        {
            if (methodDeclaration == null)
            {
                return(false);
            }

            var m_rr = emitter.Resolver.ResolveNode(methodDeclaration, emitter) as MemberResolveResult;

            if (m_rr == null || !(m_rr.Member is IMethod))
            {
                return(false);
            }

            var m = (IMethod)m_rr.Member;

            return(Helpers.IsEntryPointCandidate(m));
        }