Skip to content

Commit

Permalink
Fixed module opening toplevel constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford committed Aug 7, 2009
1 parent 3b95bdb commit b0e26e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 0 additions & 2 deletions kernel/compiler/nodes.rb
Expand Up @@ -1808,8 +1808,6 @@ def consume(sexp)

if name_node.is? ConstFind
parent = nil
elsif name_node.is? ConstAtTop
parent = name
else
parent = name_node.parent
end
Expand Down
21 changes: 20 additions & 1 deletion spec/compiler/module_spec.rb
Expand Up @@ -32,10 +32,29 @@ module ::Y
end

compile do |g|
in_module :Y do |d|
g.push_const :Rubinius
g.push_literal :Y
g.push_cpath_top
g.send :open_module_under, 2
g.dup
g.push_const :Rubinius
g.swap
g.push_literal :__module_init__
g.swap
g.push_literal_desc :Y do |d|
d.push_self
d.add_scope
d.push :self
d.send :c, 0, true
d.ret
end

g.swap
g.push_scope
g.swap
g.send :attach_method, 4
g.pop
g.send :__module_init__, 0
end
end

Expand Down

0 comments on commit b0e26e3

Please sign in to comment.