Ejemplo n.º 1
0
        public static RubyMethod/*!*/ Bind(UnboundMethod/*!*/ self, object target) {
            RubyContext ec = self._targetConstraint.Context;

            if (!ec.GetClassOf(target).HasAncestor(self._targetConstraint)) {
                throw RubyExceptions.CreateTypeError(
                    String.Format("bind argument must be an instance of {0}", self._targetConstraint.Name)
                );
            }
            
            return new RubyMethod(target, self._info, self._name);
        }
Ejemplo n.º 2
0
        public static RubyMethod/*!*/ Bind(UnboundMethod/*!*/ self, object target) {
            RubyContext context = self._targetConstraint.Context;

            if (!context.IsKindOf(target, self._targetConstraint)) {
                throw RubyExceptions.CreateTypeError(
                    String.Format("bind argument must be an instance of {0}", self._targetConstraint.GetName(context))
                );
            }
            
            return new RubyMethod(target, self._info, self._name);
        }
Ejemplo n.º 3
0
        public static RubyMethod /*!*/ Bind(UnboundMethod /*!*/ self, object target)
        {
            RubyContext ec = self._targetConstraint.Context;

            if (!ec.GetClassOf(target).HasAncestor(self._targetConstraint))
            {
                throw RubyExceptions.CreateTypeError(
                          String.Format("bind argument must be an instance of {0}", self._targetConstraint.Name)
                          );
            }

            return(new RubyMethod(target, self._info, self._name));
        }
Ejemplo n.º 4
0
        public static RubyMethod /*!*/ Bind(UnboundMethod /*!*/ self, object target)
        {
            RubyContext context = self._targetConstraint.Context;

            if (!context.IsKindOf(target, self._targetConstraint))
            {
                throw RubyExceptions.CreateTypeError(
                          "bind argument must be an instance of {0}", self._targetConstraint.GetName(context)
                          );
            }

            return(new RubyMethod(target, self._info, self._name));
        }
Ejemplo n.º 5
0
 public static bool Equal(UnboundMethod/*!*/ self, object other)
 {
     return false;
 }
Ejemplo n.º 6
0
 public static bool Equal(UnboundMethod/*!*/ self, [NotNull]UnboundMethod/*!*/ other)
 {
     return ReferenceEquals(self.Info, other.Info);
 }
Ejemplo n.º 7
0
 public static UnboundMethod /*!*/ SelectOverload(RubyContext /*!*/ context, UnboundMethod /*!*/ self, [NotNullItems] params object /*!*/[] /*!*/ parameterTypes)
 {
     return(new UnboundMethod(self.TargetConstraint, self.Name, MethodOps.SelectOverload(context, self.Info, self.Name, parameterTypes)));
 }
Ejemplo n.º 8
0
        public static UnboundMethod /*!*/ DefineMethod(RubyScope /*!*/ scope, RubyModule /*!*/ self,
                                                       [NotNull] ClrName /*!*/ methodName, [NotNull] UnboundMethod /*!*/ method)
        {
            var result = DefineMethod(scope, self, methodName.MangledName, method);

            if (methodName.HasMangledName)
            {
                self.AddMethodAlias(methodName.ActualName, methodName.MangledName);
            }
            return(result);
        }
Ejemplo n.º 9
0
 public static MutableString /*!*/ ToS(RubyContext /*!*/ context, RubyMethod /*!*/ self)
 {
     return(UnboundMethod.ToS(context, self.Name, self.Info.DeclaringModule, self.GetTargetClass(), "Method"));
 }
Ejemplo n.º 10
0
 public static UnboundMethod SelectOverload(RubyContext/*!*/ context, UnboundMethod/*!*/ self, [NotNullItems]params object/*!*/[]/*!*/ parameterTypes)
 {
     return new UnboundMethod(self.TargetConstraint, self.Name, MethodOps.SelectOverload(context, self.Info, self.Name, parameterTypes));
 }
Ejemplo n.º 11
0
 public static RubyArray GetParameters(UnboundMethod/*!*/ self)
 {
     return self.Info.GetRubyParameterArray();
 }
Ejemplo n.º 12
0
 public static int GetArity(UnboundMethod /*!*/ self)
 {
     return(self.Info.GetArity());
 }
Ejemplo n.º 13
0
 public static bool Equal(UnboundMethod /*!*/ self, [NotNull] UnboundMethod /*!*/ other)
 {
     return(ReferenceEquals(self.Info, other.Info));
 }
Ejemplo n.º 14
0
 public static bool Equal(UnboundMethod /*!*/ self, object other)
 {
     return(false);
 }
Ejemplo n.º 15
0
 public static RubyArray /*!*/ GetParameters(UnboundMethod /*!*/ self)
 {
     return(self.Info.GetRubyParameterArray());
 }
Ejemplo n.º 16
0
 public static RubyArray GetSourceLocation(UnboundMethod /*!*/ self)
 {
     return(GetSourceLocation(self.Info));
 }
Ejemplo n.º 17
0
 public static RubyArray /*!*/ GetClrMembers(UnboundMethod /*!*/ self)
 {
     return(new RubyArray(self.Info.GetMembers()));
 }
Ejemplo n.º 18
0
 public static int GetArity(UnboundMethod/*!*/ self)
 {
     return self.Info.GetArity();
 }
Ejemplo n.º 19
0
 public static UnboundMethod /*!*/ Clone(UnboundMethod /*!*/ self)
 {
     return(new UnboundMethod(self._targetConstraint, self._name, self._info));
 }
Ejemplo n.º 20
0
 public static RubyArray GetClrMembers(UnboundMethod/*!*/ self)
 {
     return new RubyArray(self.Info.GetMembers());
 }
Ejemplo n.º 21
0
 public static MutableString /*!*/ ToS(RubyContext /*!*/ context, UnboundMethod /*!*/ self)
 {
     return(ToS(context, self.Name, self._info.DeclaringModule, self._targetConstraint, "UnboundMethod"));
 }
Ejemplo n.º 22
0
 public static RubyArray GetSourceLocation(UnboundMethod/*!*/ self)
 {
     return GetSourceLocation(self.Info);
 }
Ejemplo n.º 23
0
 public static MutableString/*!*/ ToS(UnboundMethod/*!*/ self) {
     return ToS(self.Name, self._info.DeclaringModule, self._targetConstraint, "UnboundMethod");
 }
Ejemplo n.º 24
0
 public static MutableString ToS(RubyContext/*!*/ context, UnboundMethod/*!*/ self)
 {
     return ToS(context, self.Name, self._info.DeclaringModule, self._targetConstraint, "UnboundMethod");
 }
Ejemplo n.º 25
0
 public static UnboundMethod BingGenericParameters(RubyContext/*!*/ context, UnboundMethod/*!*/ self, [NotNullItems]params object/*!*/[]/*!*/ typeArgs)
 {
     return new UnboundMethod(self.TargetConstraint, self.Name, MethodOps.BindGenericParameters(context, self.Info, self.Name, typeArgs));
 }
Ejemplo n.º 26
0
 public static UnboundMethod /*!*/ DefineMethod(RubyScope /*!*/ scope, RubyModule /*!*/ self,
                                                [DefaultProtocol, NotNull] string /*!*/ methodName, [NotNull] UnboundMethod /*!*/ method)
 {
     DefineMethod(scope, self, methodName, method.Info, method.TargetConstraint);
     return(method);
 }
Ejemplo n.º 27
0
 public static UnboundMethod Clone(UnboundMethod/*!*/ self)
 {
     return new UnboundMethod(self._targetConstraint, self._name, self._info);
 }
Ejemplo n.º 28
0
        public static UnboundMethod /*!*/ DefineMethod(RubyModule /*!*/ self,
                                                       [DefaultProtocol] string /*!*/ methodName, [NotNull] UnboundMethod /*!*/ method)
        {
            // MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
            if (!self.HasAncestor(method.TargetConstraint))
            {
                throw RubyExceptions.CreateTypeError(
                          String.Format("bind argument must be a subclass of {0}", method.TargetConstraint.Name)
                          );
            }

            self.AddDefinedMethod(methodName, method.Info);
            return(method);
        }
Ejemplo n.º 29
0
 public static UnboundMethod /*!*/ BingGenericParameters(RubyContext /*!*/ context, UnboundMethod /*!*/ self, [NotNullItems] params object /*!*/[] /*!*/ typeArgs)
 {
     return(new UnboundMethod(self.TargetConstraint, self.Name, MethodOps.BindGenericParameters(context, self.Info, self.Name, typeArgs)));
 }