Explorar o código

Cast trumps binary expression.

woollybah %!s(int64=9) %!d(string=hai) anos
pai
achega
e1205baf20
Modificáronse 1 ficheiros con 9 adicións e 3 borrados
  1. 9 3
      parser.bmx

+ 9 - 3
parser.bmx

@@ -1029,9 +1029,15 @@ Type TParser
 				expr=New TCastExpr.Create( ty,expr,CAST_EXPLICIT )
 				expr=New TCastExpr.Create( ty,expr,CAST_EXPLICIT )
 			Else
 			Else
 				expr=ParseExpr()
 				expr=ParseExpr()
-'				Parse ")"
-				expr=New TCastExpr.Create( ty,expr,CAST_EXPLICIT )
-'				expr=New TIdentExpr.Create( id )
+				
+				If TBinaryExpr(expr) Then
+					' cast lhs and apply to rhs
+					Local cexpr:TCastExpr=New TCastExpr.Create( ty,TBinaryExpr(expr).lhs,CAST_EXPLICIT )
+					TBinaryExpr(expr).lhs = cexpr 
+				Else
+					expr=New TCastExpr.Create( ty,expr,CAST_EXPLICIT )
+				End If
+
 			EndIf
 			EndIf
 		Case "sizeof"
 		Case "sizeof"
 			NextToke
 			NextToke