|
@@ -323,13 +323,7 @@ def set_default_visibility(self, space, visibility): |
|
|
pass |
|
|
|
|
|
def set_method_visibility(self, space, name, visibility): |
|
|
w_method = self.find_method(space, name) |
|
|
if w_method is None or isinstance(w_method, UndefMethod): |
|
|
cls_name = space.obj_to_s(self) |
|
|
raise space.error(space.w_NameError, |
|
|
"undefined method `%s' for class `%s'" % (name, cls_name) |
|
|
) |
|
|
self.define_method(space, name, w_method.change_visibility(visibility)) |
|
|
pass |
|
|
|
|
|
def method_added(self, space, w_name): |
|
|
space.send(self, "method_added", [w_name]) |
|
@@ -502,15 +496,15 @@ def method_name(self, space): |
|
|
|
|
|
@classdef.method("private") |
|
|
def method_private(self, space, args_w): |
|
|
self.set_visibility(space, args_w, W_FunctionObject.PRIVATE) |
|
|
self.set_visibility(space, args_w, "private") |
|
|
|
|
|
@classdef.method("public") |
|
|
def method_public(self, space, args_w): |
|
|
self.set_visibility(space, args_w, W_FunctionObject.PUBLIC) |
|
|
self.set_visibility(space, args_w, "public") |
|
|
|
|
|
@classdef.method("protected") |
|
|
def method_protected(self, space, args_w): |
|
|
self.set_visibility(space, args_w, W_FunctionObject.PROTECTED) |
|
|
self.set_visibility(space, args_w, "protected") |
|
|
|
|
|
@classdef.method("private_constant") |
|
|
def method_private_constant(self, space, args_w): |
|
@@ -679,6 +673,7 @@ def method_comparison(self, space, w_other): |
|
|
else: |
|
|
return space.newint(1) |
|
|
|
|
|
|
|
|
@classdef.method("instance_method", name="symbol") |
|
|
def method_instance_method(self, space, name): |
|
|
return space.newmethod(name, self) |
|
|