Skip to content
Permalink
Browse files

Merge pull request #694 from krekoten/module_extend_object

Module#extend_object
  • Loading branch information
alex committed May 9, 2013
2 parents e672004 + 1fa1933 commit c1b539f4b79e00447122795c7e3a2f7c44c93948
Showing with 10 additions and 13 deletions.
  1. +0 −3 spec/tags/core/module/extend_object_tags.txt
  2. +8 −9 topaz/objects/moduleobject.py
  3. +2 −1 topaz/objects/objectobject.py

This file was deleted.

@@ -282,15 +282,10 @@ def included(self, space, w_mod):
if space.respond_to(self, "included"):
space.send(self, "included", [w_mod])

def extend_object(self, space, w_obj, w_mod):
if w_mod not in self.ancestors():
self.included_modules = [w_mod] + self.included_modules
w_mod.extended(space, w_obj, self)

def extended(self, space, w_obj, w_mod):
self.descendants.append(w_mod)
if space.respond_to(self, "extended"):
space.send(self, "extended", [w_obj])
def extend_object(self, space, w_mod):
if self not in w_mod.ancestors():
self.descendants.append(w_mod)
w_mod.included_modules = [self] + w_mod.included_modules

def set_visibility(self, space, names_w, visibility):
names = [space.symbol_w(w_name) for w_name in names_w]
@@ -457,6 +452,10 @@ def method_extended(self, space, w_mod):
# TODO: should be private
pass

@classdef.method("extend_object")
def method_extend_object(self, space, w_obj):
self.extend_object(space, space.getsingletonclass(w_obj))

@classdef.method("name")
def method_name(self, space):
if self.name is None:
@@ -152,7 +152,8 @@ def method_extend(self, space, w_mod):
space.w_TypeError,
"wrong argument type %s (expected Module)" % name
)
self.getsingletonclass(space).extend_object(space, self, w_mod)
space.send(w_mod, "extend_object", [self])
space.send(w_mod, "extended", [self])

@classdef.method("inspect")
def method_inspect(self, space):

0 comments on commit c1b539f

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