Browse Source

Cast trumps binary expression.

woollybah 9 years ago
parent
commit
e1205baf20
1 changed files with 9 additions and 3 deletions
  1. 9 3
      parser.bmx

+ 9 - 3
parser.bmx

@@ -1029,9 +1029,15 @@ Type TParser
 				expr=New TCastExpr.Create( ty,expr,CAST_EXPLICIT )
 			Else
 				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
 		Case "sizeof"
 			NextToke