Explorar el Código

[WIP] Duplicated Class names

This commit at least fixes that some classes have the same name, e.g. the name of an expansion class and the name of the script block part within the file.

WIP since it still needs more doing and a way to properly store already generated names.
kindlich hace 5 años
padre
commit
20f966f47e
No se encontró ninguna clave conocida en la base de datos para esta firma

+ 3
- 2
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaCompiler.java Ver fichero

@@ -36,7 +36,8 @@ import org.openzen.zenscript.javashared.prepare.JavaPrepareDefinitionVisitor;
36 36
  */
37 37
 public class JavaCompiler {
38 38
 	private int generatedScriptBlockCounter = 0;
39
-	
39
+	private int expansionCounter = 0;
40
+
40 41
 	public JavaCompiler() {}
41 42
 	
42 43
 	public JavaBytecodeModule compile(String packageName, SemanticModule module, JavaCompileSpace space) {
@@ -47,7 +48,7 @@ public class JavaCompiler {
47 48
 		context.addModule(module.module, target);
48 49
 		
49 50
 		for (HighLevelDefinition definition : module.definitions.getAll()) {
50
-			String filename = getFilename(definition);
51
+			String filename = getFilename(definition) + "_" + (definition.name == null ? "generated" : definition.name) + "_" + expansionCounter++;
51 52
 			JavaPrepareDefinitionVisitor definitionPreparer = new JavaPrepareDefinitionVisitor(context, target, filename, null);
52 53
 			definition.accept(definitionPreparer);
53 54
 		}

Loading…
Cancelar
Guardar