Reported by rogerpack2005, May 28, 2011
Run the following code:
importjava.util.ArrayListinterfaceCallableOneArgdodefcall(arg1:Object):Objectendend# should I make this class static? cache it [in a hash]?classRubyInt < Objectdeftimes(call_me:CallableOneArg):ObjectselfendendRubyInt.new.timesdo |n|
=> Mirah::InternalCompilerError: undefined method `each' for nil:NilClass
The problem was that a Block with an empty body was being transformed into an AST node with a nil body.
The typer then checks the body to see if it contains any method definitions and if it does it appends them to the class representing the block.
The code was blowing up where it checked for children of the body because the body was nil. Now the body will be an AST node with no children.