Inheritance: IDynamicObject
示例#1
0
 public static Proc/*!*/ ToProc(RubyContext/*!*/ context, RubyMethod/*!*/ self) {
     RubyMethodInfo mi = self.Info as RubyMethodInfo;
     if (mi != null) {
         return Proc.Create(context, mi.Method, self.Target, mi.Arity);
     }
     // TODO: figure out what the semantics should be for a set of CLR methods returned ...
     throw new NotImplementedException();
 }
示例#2
0
        public static Proc /*!*/ ToProc(RubyContext /*!*/ context, RubyMethod /*!*/ self)
        {
            RubyMethodInfo mi = self.Info as RubyMethodInfo;

            if (mi != null)
            {
                return(Proc.Create(context, mi.Method, self.Target, mi.Arity));
            }
            // TODO: figure out what the semantics should be for a set of CLR methods returned ...
            throw new NotImplementedException();
        }
示例#3
0
        public static RubyMethod /*!*/ DefineMethod(RubyScope /*!*/ scope, RubyModule /*!*/ self,
                                                    [NotNull] ClrName /*!*/ methodName, [NotNull] RubyMethod /*!*/ method)
        {
            var result = DefineMethod(scope, self, methodName.MangledName, method);

            if (methodName.HasMangledName)
            {
                self.AddMethodAlias(methodName.ActualName, methodName.MangledName);
            }
            return(result);
        }
示例#4
0
 public static Proc /*!*/ ToProc(RubyScope /*!*/ scope, RubyMethod /*!*/ self)
 {
     return(self.ToProc(scope));
 }
示例#5
0
 public static RubyMethod /*!*/ BindGenericParameters(RubyContext /*!*/ context, RubyMethod /*!*/ self, [NotNullItems] params object /*!*/[] /*!*/ typeArgs)
 {
     return(new RubyMethod(self.Target, BindGenericParameters(context, self.Info, self.Name, typeArgs), self.Name));
 }
示例#6
0
 public static bool Equal(RubyMethod /*!*/ self, object other)
 {
     return(false);
 }
示例#7
0
 public static RubyMethod /*!*/ Clone(RubyMethod /*!*/ self)
 {
     return(new RubyMethod(self.Target, self.Info, self.Name));
 }
示例#8
0
 public static RubyArray GetParameters(RubyMethod/*!*/ self)
 {
     return self.Info.GetRubyParameterArray();
 }
示例#9
0
 public static RubyArray /*!*/ GetClrMembers(RubyMethod /*!*/ self)
 {
     return(new RubyArray(self.Info.GetMembers()));
 }
示例#10
0
 public Meta(Expression /*!*/ expression, Restrictions /*!*/ restrictions, RubyMethod /*!*/ value)
     : base(expression, restrictions, value)
 {
     ContractUtils.RequiresNotNull(value, "value");
 }
示例#11
0
 public static RubyMethod/*!*/ SelectOverload_old(RubyContext/*!*/ context, RubyMethod/*!*/ self, [NotNullItems]params object/*!*/[]/*!*/ parameterTypes) {
     throw RubyExceptions.CreateNameError("Method#overloads is an obsolete name, use Method#overload.");
 }
示例#12
0
 public static Delegate/*!*/ CreateDelegateFromMethod(Type/*!*/ type, RubyMethod/*!*/ method) {
     return method.Info.Context.GetDelegate(method, type);
 }
示例#13
0
 public static RubyContext/*!*/ GetContextFromMethod(RubyMethod/*!*/ method) {
     return method.Info.Context;
 }
示例#14
0
 public static RubyMethod/*!*/ GetOverloads(RubyContext/*!*/ context, RubyMethod/*!*/ self, [NotNull]params object[]/*!*/ parameterTypes) {
     return new RubyMethod(self.Target, GetOverloads(context, self.Info, self.Name, parameterTypes), self.Name);
 }
示例#15
0
 public Meta(Expression/*!*/ expression, BindingRestrictions/*!*/ restrictions, RubyMethod/*!*/ value)
     : base(expression, restrictions, value) {
     ContractUtils.RequiresNotNull(value, "value");
 }
示例#16
0
 public static RubyArray GetSourceLocation(RubyMethod/*!*/ self)
 {
     return UnboundMethod.GetSourceLocation(self.Info);
 }
示例#17
0
 public static RubyArray GetSourceLocation(RubyMethod /*!*/ self)
 {
     return(UnboundMethod.GetSourceLocation(self.Info));
 }
示例#18
0
 public static RubyMethod /*!*/ SelectOverload_old(RubyContext /*!*/ context, RubyMethod /*!*/ self, [NotNullItems] params object /*!*/[] /*!*/ parameterTypes)
 {
     throw RubyExceptions.CreateNameError("Method#overloads is an obsolete name, use Method#overload.");
 }
示例#19
0
 public static RubyMethod/*!*/ BindGenericParameters(RubyContext/*!*/ context, RubyMethod/*!*/ self, [NotNullItems]params object/*!*/[]/*!*/ typeArgs) {
     return new RubyMethod(self.Target, BindGenericParameters(context, self.Info, self.Name, typeArgs), self.Name);
 }
示例#20
0
 public static RubyArray /*!*/ GetParameters(RubyMethod /*!*/ self)
 {
     return(self.Info.GetRubyParameterArray());
 }
示例#21
0
 public static RubyMethod/*!*/ SelectOverload(RubyContext/*!*/ context, RubyMethod/*!*/ self, [NotNullItems]params object/*!*/[]/*!*/ parameterTypes) {
     return new RubyMethod(self.Target, SelectOverload(context, self.Info, self.Name, parameterTypes), self.Name);
 }
示例#22
0
 public static RubyArray/*!*/ GetClrMembers(RubyMethod/*!*/ self) {
     return new RubyArray(self.Info.GetMembers());
 }
示例#23
0
 public static RubyMethod /*!*/ SelectOverload(RubyContext /*!*/ context, RubyMethod /*!*/ self, [NotNullItems] params object /*!*/[] /*!*/ parameterTypes)
 {
     return(new RubyMethod(self.Target, SelectOverload(context, self.Info, self.Name, parameterTypes), self.Name));
 }
示例#24
0
 public static bool Equal(RubyMethod/*!*/ self, [NotNull]RubyMethod/*!*/ other) {
     // TODO: method with changed visibility, define_methods, module_functions, aliases:
     return ReferenceEquals(self.Target, other.Target) && ReferenceEquals(self.Info, other.Info);
 }
示例#25
0
 public static bool Equal(RubyMethod /*!*/ self, [NotNull] RubyMethod /*!*/ other)
 {
     // TODO: method with changed visibility, define_methods, module_functions, aliases:
     return(ReferenceEquals(self.Target, other.Target) && ReferenceEquals(self.Info, other.Info));
 }
示例#26
0
 public static bool Equal(RubyMethod/*!*/ self, object other) {
     return false;
 }
示例#27
0
 public static int GetArity(RubyMethod /*!*/ self)
 {
     return(self.Info.GetArity());
 }
示例#28
0
 public static int GetArity(RubyMethod/*!*/ self) {
     return self.Info.GetArity();            
 }
示例#29
0
 public static MutableString /*!*/ ToS(RubyContext /*!*/ context, RubyMethod /*!*/ self)
 {
     return(UnboundMethod.ToS(context, self.Name, self.Info.DeclaringModule, self.GetTargetClass(), "Method"));
 }
示例#30
0
 public static RubyMethod/*!*/ Clone(RubyMethod/*!*/ self) {
     return new RubyMethod(self.Target, self.Info, self.Name);
 }
示例#31
0
 public static UnboundMethod /*!*/ Unbind(RubyMethod /*!*/ self)
 {
     return(new UnboundMethod(self.GetTargetClass(), self.Name, self.Info));
 }
示例#32
0
 public static MutableString/*!*/ ToS(RubyContext/*!*/ context, RubyMethod/*!*/ self) {
     return UnboundMethod.ToS(context, self.Name, self.Info.DeclaringModule, self.GetTargetClass(), "Method");
 }
示例#33
0
 public static RubyMethod /*!*/ DefineMethod(RubyScope /*!*/ scope, RubyModule /*!*/ self,
                                             [DefaultProtocol, NotNull] string /*!*/ methodName, [NotNull] RubyMethod /*!*/ method)
 {
     DefineMethod(scope, self, methodName, method.Info, method.GetTargetClass());
     return(method);
 }
示例#34
0
 public static Proc/*!*/ ToProc(RubyScope/*!*/ scope, RubyMethod/*!*/ self) {
     return self.ToProc(scope);
 }
示例#35
0
        public static RubyMethod /*!*/ DefineMethod(RubyModule /*!*/ self,
                                                    [DefaultProtocol] string /*!*/ methodName, [NotNull] RubyMethod /*!*/ method)
        {
            // MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
            var targetClass = method.GetTargetClass();

            if (!self.HasAncestor(targetClass))
            {
                throw RubyExceptions.CreateTypeError(
                          String.Format("bind argument must be a subclass of {0}", targetClass.Name)
                          );
            }

            self.AddDefinedMethod(methodName, method.Info);
            return(method);
        }
示例#36
0
 public static UnboundMethod/*!*/ Unbind(RubyMethod/*!*/ self) {
     return new UnboundMethod(self.GetTargetClass(), self.Name, self.Info);
 }