You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat Macros.mirah
class Macros
def initialize
@foo = "It works."
end
macro def attr_reader(name_node)
name = name_node.string_value
quote {
def `name`
@`name`
end
}
end
attr_reader :foo
end
mirahc Macros.mirah with Mirah 0.0.11 and JRuby 1.6.7 works fine, however translating to Java causes a following error.
$ mirahc --java Macros.mirah
Parsing...
Macros.mirah
Inferring types...
Compiling...
Macros.mirah
Macros.mirah:15: undefined method `block' for nil:NilClass
attr_reader :foo
^^^^^^^^^^^^^^^^^^
Mirah::InternalCompilerError: undefined method `block' for nil:NilClass
compile at mirah-0.0.11-java/lib/mirah/compiler/structure.rb:32
send at org/jruby/RubyKernel.java:2084
<Class:0x1de40494> at file:jruby-complete-1.6.7.jar!/META-INF/jruby.home/lib/ruby/1.8/delegate.rb:292
maybe_store at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:351
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:357
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/base.rb:212
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:356
compile at mirah-0.0.11-java/lib/mirah/compiler/structure.rb:21
maybe_store at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:351
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:357
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/base.rb:212
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:356
compile at mirah-0.0.11-java/lib/mirah/compiler/structure.rb:21
define_class at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:65
with at mirah-0.0.11-java/lib/mirah/jvm/compiler/base.rb:260
define_class at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:61
compile at mirah-0.0.11-java/lib/mirah/compiler/class.rb:20
maybe_store at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:351
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:357
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/base.rb:212
body at mirah-0.0.11-java/lib/mirah/jvm/compiler/java_source.rb:356
compile at mirah-0.0.11-java/lib/mirah/compiler/structure.rb:21
define_main at mirah-0.0.11-java/lib/mirah/jvm/compiler/base.rb:94
compile at mirah-0.0.11-java/lib/mirah/compiler/structure.rb:50
compile_ast at mirah-0.0.11-java/lib/mirah/compiler.rb:49
compile_asts at mirah-0.0.11-java/lib/mirah/compiler.rb:40
each at org/jruby/RubyArray.java:1615
compile_asts at mirah-0.0.11-java/lib/mirah/compiler.rb:38
generate at mirah-0.0.11-java/lib/mirah/generator.rb:38
execute at mirah-0.0.11-java/lib/mirah/commands/compile.rb:26
execute_base at mirah-0.0.11-java/lib/mirah/commands/base.rb:44
catch at org/jruby/RubyKernel.java:1183
execute_base at mirah-0.0.11-java/lib/mirah/commands/base.rb:42
execute at mirah-0.0.11-java/lib/mirah/commands/compile.rb:23
compile at mirah-0.0.11-java/lib/mirah.rb:40
(root) at mirah-0.0.11-java/bin/mirahc:27
load at org/jruby/RubyKernel.java:1058
(root) at mirahc:19
The text was updated successfully, but these errors were encountered:
The issue is present on current master, a86c365. Apparently the error is caused by calling @method.block in Mirah::JVM::Compiler::JavaSource#scoped_body with @method being nil.
mirahc Macros.mirah
with Mirah 0.0.11 and JRuby 1.6.7 works fine, however translating to Java causes a following error.The text was updated successfully, but these errors were encountered: