Permalink
Browse files

Add toplevel cosntant

  • Loading branch information...
1 parent 582bc4b commit f854785864d182b39c0c3bcbdd25851f6d2c052f @txus committed Mar 11, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −1 lib/to_source/version.rb
  2. +5 −0 lib/to_source/visitor.rb
  3. +4 −0 test/to_source/visitor_test.rb
View
@@ -1,3 +1,3 @@
module ToSource
- VERSION = "0.1.1"
+ VERSION = "0.1.2"
end
View
@@ -222,6 +222,11 @@ def op_assign_or(node, parent)
node.right.lazy_visit self, node
end
+ def toplevel_constant(node, parent)
+ emit "::"
+ emit node.name
+ end
+
def constant_access(node, parent)
emit node.name
end
@@ -31,6 +31,10 @@ def test_ivar_access
assert_source "@foo"
end
+ def test_toplevel_constant_access
+ assert_source "::Rubinius"
+ end
+
def test_constant_access
assert_source "Rubinius"
end

0 comments on commit f854785

Please sign in to comment.