Skip to content

Commit

Permalink
badassery. all assets convert to ruby *and* eval
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Aug 12, 2008
1 parent 5600dae commit 60f6335
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/zomg/idl/visitors/ruby_sexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def visit_Interface(o)
def visit_InterfaceHeader(o)
if o.children.length > 0
[:fcall, :include,
[:array] + o.children.map { |c| [:const, c.accept(self)]} ]
[:array] + o.children.map { |c|
[:const, c.accept(self).to_s.capitalize.to_sym]
} ]
else
nil
end
Expand Down Expand Up @@ -64,7 +66,7 @@ def visit_Operation(o)
o.name.to_sym,
[:scope,
[:block,
[:args] + o.children.map { |c| c.accept(self) },
[:args] + o.children.map { |c| c.accept(self).to_s.downcase.to_sym },
[:fcall, :raise, [:array,
[:call, [:const, :NotImplementedError], :new]]
]
Expand Down Expand Up @@ -96,7 +98,7 @@ def visit_IntegerLiteral(o)

def visit_Struct(o)
[ :cdecl,
o.name.to_sym,
o.name.capitalize.to_sym,
[ :call, [:const, :Struct],
:new,
[:array] + o.children.map { |c|
Expand Down
4 changes: 2 additions & 2 deletions test/test_assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module AssetTests
define_method(:"test_#{name.gsub('.', '_')}_to_ruby") do
ruby = nil
assert_nothing_raised { ruby = @tree.to_ruby }
#x = Module.new
#assert_nothing_raised { x.module_eval(ruby) }
x = Module.new
assert_nothing_raised { x.module_eval(ruby) }
end
end
}
Expand Down

0 comments on commit 60f6335

Please sign in to comment.