private static void DefineMethod(RubyScope /*!*/ scope, RubyModule /*!*/ self, string /*!*/ methodName, RubyMemberInfo /*!*/ info,
RubyModule /*!*/ targetConstraint)
{
var visibility = GetDefinedMethodVisibility(scope, self, methodName);
using (self.Context.ClassHierarchyLocker()) {
// MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
if (!self.HasAncestorNoLock(targetConstraint))
{
throw RubyExceptions.CreateTypeError(
"bind argument must be a subclass of {0}", targetConstraint.GetName(scope.RubyContext)
);
}
self.SetDefinedMethodNoEventNoLock(self.Context, methodName, info, visibility);
}
self.MethodAdded(methodName);
}