Explorar el Código

Added ScriptLoader parameter to ScriptingEngine#run

kindlich hace 6 años
padre
commit
94a48a0942
No se encontró ninguna clave conocida en la base de datos para esta firma

+ 8
- 4
JavaIntegration/src/main/java/org/openzen/zencode/java/ScriptingEngine.java Ver fichero

@@ -128,19 +128,23 @@ public class ScriptingEngine {
128 128
 	public void run() {
129 129
 		run(Collections.emptyMap());
130 130
 	}
131
-	
131
+
132 132
 	public void run(Map<FunctionParameter, Object> arguments) {
133
+		run(arguments, this.getClass().getClassLoader());
134
+	}
135
+
136
+	public void run(Map<FunctionParameter, Object> arguments, ClassLoader parentClassLoader) {
133 137
 		SimpleJavaCompileSpace javaSpace = new SimpleJavaCompileSpace(registry);
134 138
 		for (JavaNativeModule nativeModule : nativeModules)
135 139
 			javaSpace.register(nativeModule.getCompiled());
136
-		
140
+
137 141
 		JavaCompiler compiler = new JavaCompiler();
138
-		
142
+
139 143
 		JavaBytecodeRunUnit runUnit = new JavaBytecodeRunUnit();
140 144
 		for (SemanticModule compiled : compiledModules)
141 145
 			runUnit.add(compiler.compile(compiled.name, compiled, javaSpace));
142 146
 		if (debug)
143 147
 			runUnit.dump(new File("classes"));
144
-		runUnit.run(arguments);
148
+		runUnit.run(arguments, parentClassLoader);
145 149
 	}
146 150
 }

Loading…
Cancelar
Guardar