|
@@ -142,19 +142,25 @@ public class ScriptingEngine {
|
142
|
142
|
public void run(Map<FunctionParameter, Object> arguments) {
|
143
|
143
|
run(arguments, this.getClass().getClassLoader());
|
144
|
144
|
}
|
|
145
|
+
|
|
146
|
+ public JavaBytecodeRunUnit createRunUnit() {
|
|
147
|
+ SimpleJavaCompileSpace javaSpace = new SimpleJavaCompileSpace(registry);
|
|
148
|
+ for (JavaNativeModule nativeModule : nativeModules)
|
|
149
|
+ javaSpace.register(nativeModule.getCompiled());
|
|
150
|
+
|
|
151
|
+ JavaCompiler compiler = new JavaCompiler();
|
|
152
|
+
|
|
153
|
+ JavaBytecodeRunUnit runUnit = new JavaBytecodeRunUnit();
|
|
154
|
+ for (SemanticModule compiled : compiledModules)
|
|
155
|
+ runUnit.add(compiler.compile(compiled.name, compiled, javaSpace));
|
|
156
|
+ if (debug)
|
|
157
|
+ runUnit.dump(new File("classes"));
|
|
158
|
+
|
|
159
|
+ return runUnit;
|
|
160
|
+ }
|
145
|
161
|
|
146
|
162
|
public void run(Map<FunctionParameter, Object> arguments, ClassLoader parentClassLoader) {
|
147
|
|
- SimpleJavaCompileSpace javaSpace = new SimpleJavaCompileSpace(registry);
|
148
|
|
- for (JavaNativeModule nativeModule : nativeModules)
|
149
|
|
- javaSpace.register(nativeModule.getCompiled());
|
150
|
|
-
|
151
|
|
- JavaCompiler compiler = new JavaCompiler();
|
152
|
|
-
|
153
|
|
- JavaBytecodeRunUnit runUnit = new JavaBytecodeRunUnit();
|
154
|
|
- for (SemanticModule compiled : compiledModules)
|
155
|
|
- runUnit.add(compiler.compile(compiled.name, compiled, javaSpace));
|
156
|
|
- if (debug)
|
157
|
|
- runUnit.dump(new File("classes"));
|
|
163
|
+ JavaBytecodeRunUnit runUnit = createRunUnit();
|
158
|
164
|
|
159
|
165
|
try {
|
160
|
166
|
runUnit.run(arguments, parentClassLoader);
|