Refactor java code generator.
This commit is contained in:
@@ -28,7 +28,7 @@ import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.Varargs;
|
||||
import org.luaj.vm2.lib.JsePlatform;
|
||||
import org.luaj.vm2.luajc.LuaJCompiler;
|
||||
import org.luaj.vm2.luajc.LuaJC;
|
||||
|
||||
public class TestLuaJC {
|
||||
// create the script
|
||||
@@ -48,9 +48,7 @@ public class TestLuaJC {
|
||||
LuaValue chunk;
|
||||
if ( ! (args.length>0 && args[0].equals("nocompile")) ) {
|
||||
InputStream is = new ByteArrayInputStream( script.getBytes() );
|
||||
String java =LuaJCompiler.compileToJava(is, "script");
|
||||
System.out.println("java:\n"+java);
|
||||
chunk = LuaJCompiler.javaCompile(java, "script");
|
||||
chunk = LuaJC.getInstance().load(is, "script", _G);
|
||||
} else {
|
||||
chunk = (LuaValue) Class.forName("script").newInstance();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.luaj.vm2.compiler.LuaC;
|
||||
import org.luaj.vm2.luajc.JavaBytecodeCompiler;
|
||||
import org.luaj.vm2.luajc.LuaJC;
|
||||
|
||||
/**
|
||||
* Compatibility tests for the Luaj VM
|
||||
@@ -92,7 +92,7 @@ public class CompatibiltyTest {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
System.setProperty("JME", "false");
|
||||
JavaBytecodeCompiler.install();
|
||||
LuaJC.install();
|
||||
}
|
||||
// not supported on this platform - don't test
|
||||
public void testDebugLib() {}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.io.InputStream;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.vm2.compiler.LuaC;
|
||||
import org.luaj.vm2.luajc.JavaBytecodeCompiler;
|
||||
import org.luaj.vm2.luajc.LuaJC;
|
||||
|
||||
/**
|
||||
* Test compilation of various fragments that have
|
||||
@@ -43,7 +43,7 @@ public class FragmentsTest extends TestCase {
|
||||
InputStream is = new ByteArrayInputStream(script.getBytes("UTF-8"));
|
||||
LuaValue chunk ;
|
||||
if ( true ) {
|
||||
chunk = JavaBytecodeCompiler.load(is,name,_G);
|
||||
chunk = LuaJC.getInstance().load(is,name,_G);
|
||||
} else {
|
||||
chunk = (new LuaC()).load( is, name, _G );
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.io.PrintStream;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.vm2.lib.BaseLib;
|
||||
import org.luaj.vm2.luajc.JavaBytecodeCompiler;
|
||||
import org.luaj.vm2.luajc.LuaJC;
|
||||
|
||||
abstract
|
||||
public class ScriptDrivenTest extends TestCase {
|
||||
@@ -111,7 +111,7 @@ public class ScriptDrivenTest extends TestCase {
|
||||
return c;
|
||||
} else {
|
||||
script = new FileInputStream(file);
|
||||
return JavaBytecodeCompiler.load( script, name, _G);
|
||||
return LuaJC.getInstance().load( script, name, _G);
|
||||
}
|
||||
default:
|
||||
script = new FileInputStream(file);
|
||||
|
||||
Reference in New Issue
Block a user