Kaynağa Gözat

[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 yıl önce
ebeveyn
işleme
20f966f47e
Veri tabanında bu imza için bilinen anahtar bulunamadı

+ 3
- 2
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaCompiler.java Dosyayı Görüntüle

@@ -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…
İptal
Kaydet