Sha256: 895dcafa4fc370f0961f5889776e59e5a552a9f64611118400e467fca8c949f9
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# TODO refactor this and test_jvm_compiler to use mirah.rb require 'test/unit' require 'mirah' class TestMacros < Test::Unit::TestCase java_import 'java.lang.System' def parse(code) Mirah::AST.type_factory = Mirah::JVM::Types::TypeFactory.new name = "script" + System.nano_time.to_s state = Mirah::Util::CompilationState.new state.save_extensions = false transformer = Mirah::Transform::Transformer.new(state) Java::MirahImpl::Builtin.initialize_builtins(transformer) ast = Mirah::AST.parse(code, name, true, transformer) typer = Mirah::JVM::Typer.new(transformer) ast.infer(typer, true) typer.resolve(true) ast end def test_macro_helper script = parse(<<-EOF) import duby.lang.compiler.Compiler def helper(mirah:Compiler) name = "foobar" mirah.quote { `name` } end EOF end def test_self_call_in_unquote script = parse(<<-EOF) import duby.lang.compiler.Compiler def foobar(name:String) name end def helper(mirah:Compiler) name = "foobar" mirah.quote { `foobar(name)` } end EOF end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.0.9-java | test/core/test_macros.rb |
mirah-0.0.8-java | test/core/test_macros.rb |