예제 #1
0
        public ZLMethodInfo[] SearchDeclaredZMethod(ZMethodCall zcall)
        {
            List <ZLMethodInfo> methods = new List <ZLMethodInfo>();

            foreach (var item in this.ZMethods)
            {
                if (item.HasZProcDesc(zcall))
                {
                    methods.Add(item);
                }
            }
            if (methods.Count > 1)
            {
                ZLMethodInfo tempMethod = methods[0];
                for (int i = 1; i < methods.Count; i++)
                {
                    var itemMethod = methods[i];
                    ZTypeCompareEnum compareEnum = ParamCompare(tempMethod, itemMethod);
                    if (compareEnum == ZTypeCompareEnum.SuperOf)
                    {
                        tempMethod = itemMethod;
                    }
                }
                methods.Clear();
                methods.Add(tempMethod);
            }
            return(methods.ToArray());
        }
예제 #2
0
        public static ZLMethodDesc[] GetProcDescs(ZLMethodInfo zmethod)
        {
            var markMethod           = zmethod.MarkMethod;
            var sharpMethod          = zmethod.SharpMethod;
            List <ZLMethodDesc> list = new List <ZLMethodDesc>();

            ZCodeAttribute[] attrs = AttributeUtil.GetAttributes <ZCodeAttribute>(markMethod);
            foreach (ZCodeAttribute attr in attrs)
            {
                ZCodeParser  parser       = new ZCodeParser(sharpMethod.DeclaringType, zmethod);
                ZLMethodDesc typeProcDesc = parser.Parser(attr.Code);
                list.Add(typeProcDesc);
            }
            return(list.ToArray());
        }
예제 #3
0
        public static ZLParamInfo[] GetZLParams(ZLMethodInfo zmethod)
        {
            var markMethod  = zmethod.MarkMethod;
            var sharpMethod = zmethod.SharpMethod;

            List <ZLParamInfo> list = new List <ZLParamInfo>();

            ParameterInfo[] parameters = sharpMethod.GetParameters();
            int             index      = 0;

            foreach (ParameterInfo peramter in parameters)
            {
                ZLParamInfo zlparam = new ZLParamInfo(peramter, zmethod, index);//, false);
                list.Add(zlparam);
                index++;
            }
            return(list.ToArray());
        }
예제 #4
0
        private static ZTypeCompareEnum ParamCompare(ZLMethodInfo method1, ZLMethodInfo method2)
        {
            var parames1 = method1.ZParams;
            var parames2 = method2.ZParams;

            for (int i = 0; i < parames1.Length; i++)
            {
                var p1     = parames1[i];
                var p2     = parames2[i];
                var ztype1 = p1.GetZParamType();
                var ztype2 = p2.GetZParamType();
                ZTypeCompareEnum compareEnum = ZDescUtil.Compare(ztype1, ztype2);
                if (compareEnum != ZTypeCompareEnum.EQ)
                {
                    return(compareEnum);
                }
            }
            return(ZTypeCompareEnum.EQ);
        }
예제 #5
0
        public static ZLMethodInfo[] GetZMethods(Type markType, Type sharpType, bool isStatic, ZLClassInfo zclass)
        {
            //if (markType.Name == "控制台")
            //{
            //    Console.WriteLine("控制台");
            //}
            List <ZLMethodInfo> list = new List <ZLMethodInfo>();

            MethodInfo[] markMethods = markType.GetMethods();
            foreach (MethodInfo method in markMethods)
            {
                //if (method.Name == "Write")
                //{
                //    Console.WriteLine("Write");
                //}
                if (!ReflectionUtil.IsDeclare(markType, method))
                {
                    continue;
                }
                if (!AttributeUtil.HasAttribute <ZCodeAttribute>(method))
                {
                    continue;
                }
                MethodInfo newMethod = ReflectionUtil.GetMethod(sharpType, method);
                if (newMethod == null)
                {
                    throw new ZyyRTException();
                }
                else
                {
                    if (isStatic == newMethod.IsStatic)
                    {
                        ZLMethodInfo zmethod = new ZLMethodInfo(method, newMethod, zclass);
                        list.Add(zmethod);
                    }
                }
            }
            return(list.ToArray());
        }
예제 #6
0
 public ZLParamInfo(ParameterInfo parameterInfo, ZLMethodInfo zmethod, int paramIndex)
     : this(parameterInfo, paramIndex)//, isGenericArg)
 {
     ZMethod = zmethod;
 }
예제 #7
0
 public ZLMethodDesc(ZLMethodInfo zmethod, string zcode)
 {
     this.ZMethod = zmethod;
     _ZCode       = zcode;
 }
예제 #8
0
 //UserWordsSegementer Segementer = new UserWordsSegementer();
 public ZCodeParser(Type type, ZLMethodInfo method)
 {
     zlmethod = method;
     //genericTypeDict = GenericUtil.GetTypeNameGenericArgTypes(type); //new Dictionary<string, Type>();
     Init(type, method.SharpMethod);
 }