Browse Source

Merge remote-tracking branch 'kindlich/development' into development

Jared 5 years ago
parent
commit
1c81df7e77
No account linked to committer's email address

+ 3
- 2
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaCompiler.java View File

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

+ 0
- 17
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaExpressionVisitor.java View File

@@ -21,8 +21,6 @@ import org.openzen.zenscript.javabytecode.JavaLocalVariableInfo;
21 21
 import org.openzen.zenscript.javabytecode.compiler.JavaModificationExpressionVisitor.PushOption;
22 22
 import org.openzen.zenscript.javashared.*;
23 23
 
24
-import java.io.FileOutputStream;
25
-import java.io.IOException;
26 24
 import java.lang.reflect.Method;
27 25
 import java.lang.reflect.Modifier;
28 26
 import java.util.Arrays;
@@ -2086,12 +2084,6 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
2086 2084
 
2087 2085
 		context.register(className, lambdaCW.toByteArray());
2088 2086
 
2089
-		try (FileOutputStream out = new FileOutputStream(className + ".class")) {
2090
-			out.write(lambdaCW.toByteArray());
2091
-		} catch (IOException e) {
2092
-			e.printStackTrace();
2093
-		}
2094
-
2095 2087
 		return null;
2096 2088
 	}
2097 2089
 
@@ -4119,15 +4111,6 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
4119 4111
 		javaWriter.dupX1();
4120 4112
 		javaWriter.swap();
4121 4113
 		javaWriter.invokeSpecial(className, "<init>", constructorDesc);
4122
-
4123
-		//Debug-only, remove later
4124
-		if(true) {
4125
-			try (FileOutputStream out = new FileOutputStream(className + ".class")) {
4126
-				out.write(lambdaCW.toByteArray());
4127
-			} catch (IOException e) {
4128
-				e.printStackTrace();
4129
-			}
4130
-		}
4131 4114
 	}
4132 4115
 
4133 4116
 	@Override

+ 1
- 18
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/definitions/JavaDefinitionVisitor.java View File

@@ -28,8 +28,6 @@ import org.openzen.zenscript.javashared.JavaModifiers;
28 28
 import org.openzen.zenscript.javashared.JavaTypeGenericVisitor;
29 29
 import org.openzen.zenscript.javashared.JavaVariantOption;
30 30
 
31
-import java.io.FileOutputStream;
32
-import java.io.IOException;
33 31
 import java.util.ArrayList;
34 32
 import java.util.List;
35 33
 
@@ -186,15 +184,7 @@ public class JavaDefinitionVisitor implements DefinitionVisitor<byte[]> {
186 184
 		writer.visitEnd();
187 185
 
188 186
 
189
-		final byte[] classBytes = writer.toByteArray();
190
-
191
-		try (FileOutputStream out = new FileOutputStream("ttt.class")) {
192
-			out.write(classBytes);
193
-		} catch (IOException e) {
194
-			e.printStackTrace();
195
-		}
196
-
197
-		return classBytes;
187
+		return writer.toByteArray();
198 188
 	}
199 189
 
200 190
 	@Override
@@ -303,13 +293,6 @@ public class JavaDefinitionVisitor implements DefinitionVisitor<byte[]> {
303 293
 			optionWriter.visitEnd();
304 294
 			final byte[] byteArray = optionWriter.toByteArray();
305 295
 			context.register(optionTag.variantOptionClass.internalName, byteArray);
306
-
307
-			//Print the option files, won't be in production
308
-			try (FileOutputStream out = new FileOutputStream(optionTag.variantOptionClass.internalName.replace('/', '_') + ".class")) {
309
-				out.write(byteArray);
310
-			} catch (IOException e) {
311
-				e.printStackTrace();
312
-			}
313 296
 		}
314 297
 
315 298
 

Loading…
Cancel
Save