Browse files

removing nil from interface headers

  • Loading branch information...
tenderlove committed Aug 12, 2008
1 parent 25ad07f commit 7fb9fe10643849c4488291dd5e7de2bef99c36bf
Showing with 5 additions and 3 deletions.
  1. +3 −1 lib/zomg/idl/visitors/ruby_sexp.rb
  2. +1 −1 test/conversions/test_attribute.rb
  3. +1 −1 test/conversions/test_interface.rb
@@ -14,10 +14,12 @@ def visit_Module(o)
def visit_Interface(o)
+ header = o.header.accept(self)
+ header = header ? [:block, header] : [:block]
[ :module,,
- [:block, o.header.accept(self)] +
+ header + { |c| c.accept(self) }
@@ -20,7 +20,7 @@ def test_to_ruby_sexp
ruby_sexp =
[:module, :Foo,
- [:scope, [:block, nil,
+ [:scope, [:block,
[:fcall, :attr_accessor, [:array, [:lit, :awesome]]]
assert_equal(ruby_sexp, sexp)
@@ -19,7 +19,7 @@ def setup
def test_to_ruby_sexp
sexp = nil
- ruby_sexp = [:block, [:module, :Foo, [:scope, [:block, nil, [:defn, :a, [:scope, [:block, [:args], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]], [:defn, :b, [:scope, [:block, [:args, :a], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]], [:defn, :c, [:scope, [:block, [:args, :a, :b, :c], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]]]]], [:module, :Bar, [:scope, [:block, [:fcall, :include, [:array, [:const, :Foo], [:const, :Baz]]], [:defn, :d, [:scope, [:block, [:args], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]]]]]]
+ ruby_sexp = [:block, [:module, :Foo, [:scope, [:block, [:defn, :a, [:scope, [:block, [:args], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]], [:defn, :b, [:scope, [:block, [:args, :a], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]], [:defn, :c, [:scope, [:block, [:args, :a, :b, :c], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]]]]], [:module, :Bar, [:scope, [:block, [:fcall, :include, [:array, [:const, :Foo], [:const, :Baz]]], [:defn, :d, [:scope, [:block, [:args], [:fcall, :raise, [:array, [:call, [:const, :NotImplementedError], :new]]]]]]]]]]
assert_nothing_raised {
sexp = @tree.to_ruby_sexp

0 comments on commit 7fb9fe1

Please sign in to comment.