Преглед на файлове

[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 преди 5 години
родител
ревизия
20f966f47e
No known key found for this signature in database
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3
    2
      JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaCompiler.java

+ 3
- 2
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaCompiler.java Целия файл

@@ -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…
Отказ
Запис