상속: 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
파일: MethodOps.cs 프로젝트: TerabyteX/main
 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
파일: MethodOps.cs 프로젝트: TerabyteX/main
 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);
 }