isStatic() public method

public isStatic ( ) : bool
return bool
Example #1
0
        private void finishMethod(MethodInfo m, bool staticOnly)
        {
            m_finishing = m.Name;
            string name = FanUtil.toFanMethodName(m.Name);
            Slot   s    = slot(name, false);

            if (s == null)
            {
                return;
            }
            if (s.parent() != this)
            {
                return;
            }
            if (staticOnly && !s.isStatic())
            {
                return;
            }
            if (s is Method)
            {
                Method method = (Method)s;

                // alloc System.Reflection.MethodInfo[] array big enough
                // to handle all the versions with default parameters
                if (method.m_reflect == null)
                {
                    int n = 1;
                    for (int j = method.@params().sz() - 1; j >= 0; j--)
                    {
                        if (((Param)method.@params().get(j)).hasDefault())
                        {
                            n++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    method.m_reflect = new MethodInfo[n];
                }

                // get parameters, if sys we need to skip the
                // methods that use non-Fantom signatures
                ParameterInfo[] pars      = m.GetParameters();
                int             numParams = pars.Length;
                if (m_pod == Sys.m_sysPod)
                {
                    if (!checkAllFan(pars))
                    {
                        return;
                    }
                    if (m_dotnetRepr)
                    {
                        bool dotnetStatic = m.IsStatic;
                        if (!dotnetStatic)
                        {
                            return;
                        }
                        if (!method.isStatic() && !method.isCtor())
                        {
                            --numParams;
                        }
                    }
                }

                // zero index is full signature up to using max defaults
                method.m_reflect[method.@params().sz() - numParams] = m;
            }
            else
            {
                Field field = (Field)s;
                if (m.ReturnType.ToString() == "System.Void")
                {
                    field.m_setter.m_reflect = new MethodInfo[] { m }
                }
                ;
                else
                {
                    field.m_getter.m_reflect = new MethodInfo[] { m }
                };
            }
        }

        bool checkAllFan(ParameterInfo[] pars)
        {
            for (int i = 0; i < pars.Length; i++)
            {
                System.Type p = pars[i].ParameterType;
                if (!p.FullName.StartsWith("Fan.") && FanUtil.toFanType(p, false) == null)
                {
                    return(false);
                }
            }
            return(true);
        }