Example #1
0
        // Module#module_function/private/protected/public:
        public void SetVisibilityNoEventNoLock(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
            Context.RequiresClassHierarchyLock();

            RubyMemberInfo existing;
            bool skipHidden = false;
            if (TryGetMethod(name, ref skipHidden, out existing)) {
                // CLR members: Detaches the member from its underlying type (by creating a copy).
                SetMethodNoEventNoLock(callerContext, name, method.Copy((RubyMemberFlags)visibility, this));
            } else {
                SetMethodNoEventNoLock(callerContext, name, new SuperForwarderInfo((RubyMemberFlags)visibility, method.DeclaringModule, name));
            }
        }
Example #2
0
 // Module#module_function:
 public void SetModuleFunctionNoEventNoLock(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method) {
     // CLR members: Detaches the member from its underlying type (by creating a copy).
     // TODO: check for CLR instance members, it should be an error to call module_function on them:
     SingletonClass.SetMethodNoEventNoLock(callerContext, name, method.Copy(RubyMemberFlags.Public, SingletonClass));
 }
Example #3
0
        // Module#module_function/private/protected/public:
        public void SetVisibilityNoEventNoLock(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
            Context.RequiresClassHierarchyLock();

            RubyMemberInfo existing;
            bool skipHidden = false;
            if (TryGetMethod(name, ref skipHidden, out existing)) {
                SetMethodNoEventNoLock(callerContext, name, method.Copy((RubyMemberFlags)visibility, this));
            } else {
                SetMethodNoEventNoLock(callerContext, name, new RubyMemberInfo((RubyMemberFlags)visibility | RubyMemberFlags.SuperForwarder, method.DeclaringModule));
            }
        }
Example #4
0
 // Module#define_method:
 public void SetDefinedMethodNoEventNoLock(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
     // CLR members: Detaches the member from its underlying type (by creating a copy).
     // Note: Method#== returns false on defined methods and redefining the original method doesn't affect the new one:
     SetMethodNoEventNoLock(callerContext, name, method.Copy((RubyMemberFlags)visibility, this));
 }
Example #5
0
 // Module#define_method:
 public void SetDefinedMethodNoEventNoLock(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
     // copy method, Method#== returns false on defined methods and redefining the original method doesn't affect the new one:
     SetMethodNoEventNoLock(callerContext, name, method.Copy((RubyMemberFlags)visibility, this));
 }
Example #6
0
 public void SetMethodVisibility(string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
     if (method.Visibility != visibility) {
         AddMethod(name, method.Copy((RubyMemberFlags)visibility, this));
     }
 }
Example #7
0
 // adds instance and singleton methods of a module function:
 public void AddModuleFunction(string/*!*/ name, RubyMemberInfo/*!*/ method) {
     AddMethod(name, method.Copy(RubyMemberFlags.Private, this));
     SingletonClass.AddMethod(name, method.Copy(RubyMemberFlags.Public, SingletonClass));
 }
Example #8
0
 // adds method alias via define_method:
 public void AddDefinedMethod(string/*!*/ name, RubyMemberInfo/*!*/ method) {
     // copy method, Method#== returns false on defined methods:
     AddMethod(name, method.Copy(method.Flags, this));
 }
Example #9
0
 public void SetMethodVisibility(RubyContext/*!*/ callerContext, string/*!*/ name, RubyMemberInfo/*!*/ method, RubyMethodVisibility visibility) {
     if (method.Visibility != visibility) {
         AddMethod(callerContext, name, method.Copy((RubyMemberFlags)visibility, this));
     }
 }