瀏覽代碼

CheckCast after MapGet if not primitive

Required for Type assertion, else a 'Object is not assignable to X' will follow
kindlich 4 年之前
父節點
當前提交
fb280d54ed
沒有發現已知的金鑰在資料庫的簽署中

+ 3
- 0
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaExpressionVisitor.java 查看文件

@@ -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…
取消
儲存