Наследование: 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);
 }