Przeglądaj źródła

Fixed Object->Byte Ptr regression.

woollybah 11 lat temu
rodzic
commit
9c21134286
2 zmienionych plików z 13 dodań i 1 usunięć
  1. 8 0
      ctranslator.bmx
  2. 5 1
      expr.bmx

+ 8 - 0
ctranslator.bmx

@@ -1218,6 +1218,14 @@ EndRem
 				Return tmp
 				Return tmp
 			End If
 			End If
 
 
+			If TObjectType(src) Then
+				If TObjectType(src).classDecl.IsExtern() Then
+					Return Bra(t)
+				Else
+					Return Bra("(BBBYTE*)" + t) + "+" + Bra("sizeof(void*)")
+				End If
+			End If
+
 			Local p:String = TransSPointer(dst)
 			Local p:String = TransSPointer(dst)
 			If TByteType( dst )
 			If TByteType( dst )
 				If IsPointerType(src, TType.T_BYTE) Return t
 				If IsPointerType(src, TType.T_BYTE) Return t

+ 5 - 1
expr.bmx

@@ -832,7 +832,11 @@ Type TCastExpr Extends TExpr
 					op="ToString"
 					op="ToString"
 				Else If IsPointerType( ty, TType.T_BYTE )
 				Else If IsPointerType( ty, TType.T_BYTE )
 					exprType = ty
 					exprType = ty
-					Return expr
+					If flags = CAST_EXPLICIT Then
+						Return Self
+					Else
+						Return expr
+					End If
 				Else
 				Else
 					InternalErr
 					InternalErr
 				EndIf
 				EndIf