示例#1
0
 public RppMethodInfo([NotNull] string name, [NotNull] RType declaringType, RMethodAttributes attributes,
     [CanBeNull] RType returnType,
     [NotNull] RppParameterInfo[] parameters)
 {
     Name = name;
     DeclaringType = declaringType;
     Attributes = attributes;
     ReturnType = returnType;
     Parameters = parameters;
 }
示例#2
0
        public static MethodAttributes GetMethodAttributes(RMethodAttributes rAttributes, bool constructor)
        {
            MethodAttributes attrs = MethodAttributes.Public;

            if (rAttributes.HasFlag(RMethodAttributes.Private))
            {
                attrs = MethodAttributes.Private;
            }

            if (rAttributes.HasFlag(RMethodAttributes.Protected))
            {
                attrs = MethodAttributes.Family;
            }

            // always virtual, even for statics but not for property accessors :)
            if (!constructor && !rAttributes.HasFlag(RMethodAttributes.Final))
            {
                attrs |= MethodAttributes.Virtual;
            }

            attrs |= MethodAttributes.HideBySig;

            if (!rAttributes.HasFlag(RMethodAttributes.Override))
            {
                if (!constructor && !rAttributes.HasFlag(RMethodAttributes.Final))
                {
                    attrs |= MethodAttributes.NewSlot;
                }
            }

            if (rAttributes.HasFlag(RMethodAttributes.Abstract))
            {
                attrs |= MethodAttributes.Abstract;
            }

            return attrs;
        }
示例#3
0
        private static string ToString(RMethodAttributes attrs)
        {
            List<string> res = new List<string>();

            _attrToStr.Aggregate(res, (list, tuple) =>
                {
                    if (attrs.HasFlag(tuple.Item1))
                    {
                        list.Add(tuple.Item2);
                    }
                    return list;
                });

            return string.Join(" ", res);
        }
示例#4
0
文件: RType.cs 项目: dubik/csharprpp
 public RppMethodInfo DefineConstructor(RMethodAttributes attributes, RppParameterInfo[] parameterTypes)
 {
     RppMethodInfo constructor = new RppMethodInfo("ctor", this, attributes, UnitTy, parameterTypes);
     _constructors.Add(constructor);
     return constructor;
 }
示例#5
0
文件: RType.cs 项目: dubik/csharprpp
 public RppMethodInfo DefineConstructor(RMethodAttributes attributes)
 {
     return DefineConstructor(attributes, new RppParameterInfo[0]);
 }
示例#6
0
文件: RType.cs 项目: dubik/csharprpp
 public RppMethodInfo DefineMethod([NotNull] string name,
     RMethodAttributes attributes,
     [CanBeNull] RType returnType,
     [NotNull] RppParameterInfo[] parameterTypes,
     [NotNull] RppGenericParameter[] genericParameters)
 {
     RppMethodInfo method = new RppMethodInfo(name, this, attributes, returnType, parameterTypes);
     if (name == "ctor")
     {
         _constructors.Add(method);
     }
     else
     {
         _methods.Add(method);
     }
     return method;
 }
示例#7
0
文件: RType.cs 项目: dubik/csharprpp
 public RppMethodInfo DefineMethod([NotNull] string name,
     RMethodAttributes attributes,
     [CanBeNull] RType returnType,
     [NotNull] RppParameterInfo[] parameterTypes)
 {
     return DefineMethod(name, attributes, returnType, parameterTypes, new RppGenericParameter[0]);
 }
示例#8
0
文件: RType.cs 项目: dubik/csharprpp
 public RppMethodInfo DefineMethod([NotNull] string name, RMethodAttributes attributes)
 {
     return DefineMethod(name, attributes, null, new RppParameterInfo[0]);
 }