Skip to content
Permalink
Browse files

Merge pull request #859 from kachick/module-tweaks

Module tweaks
  • Loading branch information
alex committed Oct 26, 2015
2 parents a126ae2 + 710f9b4 commit c2c5a3b581eec2a88e3e4d7b1b47a185ded673e4
@@ -1,3 +1,2 @@
fails:Module#alias_method retains method visibility
fails:Module#alias_method is a private method
fails:Module#alias_method returns self
@@ -1,5 +1,4 @@
fails:Module#append_features is a private method
fails:Module#append_features copies own tainted status to the given module
fails:Module#append_features copies own untrusted status to the given module
fails:Module#append_features on Class raises a TypeError if calling after rebinded to Class
fails:Module#append_features when other is frozen raises a RuntimeError before appending self

This file was deleted.

@@ -1,3 +1,2 @@
fails:Module#extend_object is a private method
fails:Module#extend_object on Class raises a TypeError if calling after rebinded to Class
fails:Module#extend_object when given a frozen object raises a RuntimeError before extending the object
@@ -427,6 +427,8 @@ def method_includep(self, space, w_mod):
def method_append_features(self, space, w_mod):
if w_mod in self.ancestors():
raise space.error(space.w_ArgumentError, "cyclic include detected")
if type(self) is not W_ModuleObject:
raise space.error(space.w_TypeError, "wrong argument type")
for module in reversed(self.ancestors()):
w_mod.include_module(space, module)

@@ -521,6 +523,7 @@ def method_alias_method(self, space, new_name, old_name):
"undefined method `%s' for class `%s'" % (old_name, cls_name)
)
self.define_method(space, new_name, w_method)
return self

@classdef.method("ancestors")
def method_ancestors(self, space):
@@ -538,6 +541,8 @@ def method_extended(self, space, w_mod):

@classdef.method("extend_object")
def method_extend_object(self, space, w_obj):
if type(self) is not W_ModuleObject:
raise space.error(space.w_TypeError, "wrong argument type")
self.extend_object(space, space.getsingletonclass(w_obj))

@classdef.method("name")
@@ -626,6 +631,7 @@ def method_const_get(self, space, const, inherit=True):
return w_res

@classdef.method("const_set", const="symbol")
@check_frozen()
def method_const_set(self, space, const, w_value):
space.set_const(self, const, w_value)
return w_value

0 comments on commit c2c5a3b

Please sign in to comment.
You can’t perform that action at this time.