Browse Source

Fixed NPE in ScriptingExample due to nonpushing visitor not loaded

kindlich 4 years ago
parent
commit
bf1ecfacd3
No known key found for this signature in database

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

@@ -159,8 +159,8 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
159 159
     private final JavaBoxingTypeVisitor boxingTypeVisitor;
160 160
     private final JavaUnboxingTypeVisitor unboxingTypeVisitor;
161 161
     private final JavaCapturedExpressionVisitor capturedExpressionVisitor = new JavaCapturedExpressionVisitor(this);
162
-    private final JavaBytecodeContext context;
163
-    private final JavaCompiledModule module;
162
+    final JavaBytecodeContext context;
163
+    final JavaCompiledModule module;
164 164
 
165 165
 	public JavaExpressionVisitor(JavaBytecodeContext context, JavaCompiledModule module, JavaWriter javaWriter) {
166 166
 		this.javaWriter = javaWriter;

+ 4
- 3
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaStatementVisitor.java View File

@@ -16,8 +16,8 @@ import org.openzen.zenscript.javashared.JavaCompiledModule;
16 16
 public class JavaStatementVisitor implements StatementVisitor<Boolean> {
17 17
     private final JavaWriter javaWriter;
18 18
 	final JavaBytecodeContext context;
19
-    public JavaExpressionVisitor expressionVisitor;
20
-	public JavaNonPushingExpressionVisitor nonPushingExpressionVisitor;
19
+    public final JavaExpressionVisitor expressionVisitor;
20
+	public final JavaNonPushingExpressionVisitor nonPushingExpressionVisitor;
21 21
 
22 22
     /**
23 23
      * @param javaWriter the method writer that compiles the statement
@@ -26,13 +26,14 @@ public class JavaStatementVisitor implements StatementVisitor<Boolean> {
26 26
         this.javaWriter = javaWriter;
27 27
 		this.context = context;
28 28
         this.expressionVisitor = new JavaExpressionVisitor(context, module, javaWriter);
29
-		nonPushingExpressionVisitor = new JavaNonPushingExpressionVisitor(context, module, javaWriter, expressionVisitor);
29
+		this.nonPushingExpressionVisitor = new JavaNonPushingExpressionVisitor(context, module, javaWriter, expressionVisitor);
30 30
     }
31 31
 
32 32
     public JavaStatementVisitor(JavaBytecodeContext context, JavaExpressionVisitor expressionVisitor) {
33 33
         this.javaWriter = expressionVisitor.getJavaWriter();
34 34
 		this.context = context;
35 35
         this.expressionVisitor = expressionVisitor;
36
+		this.nonPushingExpressionVisitor = new JavaNonPushingExpressionVisitor(expressionVisitor.context, expressionVisitor.module, expressionVisitor.javaWriter, expressionVisitor);
36 37
     }
37 38
 
38 39
 	@Override

Loading…
Cancel
Save