diff --git a/ExprPrimaryNodes.py b/ExprPrimaryNodes.py index 3fa30e00ba8a56132a6a602a21866fc79eaca7ca..635d1342da41c373539b358ae90e3b57e5d6ffca 100644 --- a/ExprPrimaryNodes.py +++ b/ExprPrimaryNodes.py @@ -426,7 +426,7 @@ class CastNode(ASTNode): # only test if not primitive if self.right.myType.isArray == self.left.myType.isArray: - if (not self.left.myType.isPrimitive): + if (not self.right.myType.isPrimitive): # cast would've exception if array is casting to non-array and not Object offset = self.left.myType.typePointer.subTypeOffset self.code += p("mov", "ebx", "[eax]", "start subtype test") # access class tag of left object @@ -703,7 +703,7 @@ class ExprNode(ASTNode): # only test if non-primitive, both arrays or both non arrays if self.right.myType.isArray == self.left.myType.isArray: - if not self.right.myType.isPrimitive: + if not self.left.myType.isPrimitive: offset = self.right.myType.typePointer.subTypeOffset self.code += p("mov", "eax", "[eax]") # access class tag of left object self.code += p("mov", "eax", "[eax + 4]") # access subtype testing column diff --git a/TheTypeNode.py b/TheTypeNode.py index 40d6498737def14bc01a31fb026fa2a94a6aadb2..5100a731ab618ef1127190eca60e90c438e7ab15 100644 --- a/TheTypeNode.py +++ b/TheTypeNode.py @@ -41,7 +41,7 @@ class TypeStruct(): self.isPrimitive = False self.typePointer = typePointer self.name = name - if name in ['boolean', 'byte', 'char', 'int', 'short', 'void']: + if name in ['boolean', 'byte', 'char', 'int', 'short', 'void', 'null']: self.isPrimitive = True def link(self, env):