浏览代码

[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
找不到此签名对应的密钥

+ 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
 		}

正在加载...
取消
保存