Browse Source

Added ScriptLoader parameter to ScriptingEngine#run

kindlich 6 years ago
parent
commit
94a48a0942
No known key found for this signature in database

+ 8
- 4
JavaIntegration/src/main/java/org/openzen/zencode/java/ScriptingEngine.java View File

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

Loading…
Cancel
Save