Selaa lähdekoodia

CheckCast after MapGet if not primitive

Required for Type assertion, else a 'Object is not assignable to X' will follow
kindlich 4 vuotta sitten
vanhempi
commit
fb280d54ed
No known key found for this signature in database

+ 3
- 0
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaExpressionVisitor.java Näytä tiedosto

@@ -934,6 +934,9 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
934 934
 				javaWriter.invokeInterface(MAP_GET);
935 935
 
936 936
 				type.valueType.type.accept(type.valueType, unboxingTypeVisitor);
937
+				if(!CompilerUtils.isPrimitive(type.valueType.type)) {
938
+					javaWriter.checkCast(context.getType(type.valueType));
939
+				}
937 940
 				break;
938 941
 			}
939 942
 			case ASSOC_INDEXSET:

Loading…
Peruuta
Tallenna