Skip to content
Browse files

Merge pull request #682 from krekoten/module_name

  • Loading branch information
alex committed May 6, 2013
2 parents dcb6282 + 84300c1 commit f02639c81577d72bb932c470d1108592e4ac79fb
Showing with 10 additions and 6 deletions.
  1. +0 −3 spec/tags/core/module/name_tags.txt
  2. +3 −2 topaz/
  3. +6 −0 topaz/objects/
  4. +1 −1 topaz/
@@ -1,6 +1,3 @@
fails:Module#name is nil for a nested module created with the module keyword
fails:Module#name is set with a conditional assignment to a nested constant
fails:Module#name is set with a conditional assignment to a constant
fails:Module#name preserves the encoding in which the class was defined
fails:Module#name is set when the anonymous outer module name is set
fails:Module#name is nil when assigned to a constant in an anonymous module
@@ -202,8 +202,9 @@ def STORE_CONSTANT(self, space, bytecode, frame, pc, idx):
w_value = frame.pop()
w_scope = frame.pop()
space.set_const(w_scope, name, w_value)
if isinstance(w_value, W_ModuleObject) and is None: = space.buildname(name, w_scope)
if (isinstance(w_value, W_ModuleObject) and is None
and isinstance(w_scope, W_ModuleObject) and is not None):
w_value.set_name_in_scope(space, name, w_scope)

def DEFINED_CONSTANT(self, space, bytecode, frame, pc, idx):
@@ -315,6 +315,12 @@ def method_undefined(self, space, w_name):
def method_removed(self, space, w_name):
space.send(self, space.newsymbol("method_removed"), [w_name])

def set_name_in_scope(self, space, name, w_scope): = space.buildname(name, w_scope)
for name, w_const in self.constants_w.iteritems():
if isinstance(w_const, W_ModuleObject):
w_const.set_name_in_scope(space, name, self)

def singleton_method_nesting(self, space):
frame = space.getexecutioncontext().gettoprubyframe()
@@ -441,7 +441,7 @@ def buildname(self, name, w_scope):
if w_scope is not None:
assert isinstance(w_scope, W_ModuleObject)
if w_scope is not self.w_object:
complete_name = "%s::%s" % (, name)
complete_name = "%s::%s" % (self.obj_to_s(w_scope), name)
return complete_name

def int_w(self, w_obj):

0 comments on commit f02639c

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