2
0
Эх сурвалжийг харах

Fixed rhs function ptr issue. Fixes #240.

woollybah 8 жил өмнө
parent
commit
0d040f022e
2 өөрчлөгдсөн 13 нэмэгдсэн , 1 устгасан
  1. 8 1
      expr.bmx
  2. 5 0
      type.bmx

+ 8 - 1
expr.bmx

@@ -686,6 +686,9 @@ Type TInvokeExpr Extends TExpr
 
 
 		If ((isArg Or isRhs) And Not invokedWithBraces) And (args = Null Or args.length = 0) Then
 		If ((isArg Or isRhs) And Not invokedWithBraces) And (args = Null Or args.length = 0) Then
 			' nothing to do here, as we are probably a function pointer. i.e. no braces and no 
 			' nothing to do here, as we are probably a function pointer. i.e. no braces and no 
+			' and our expression type is a function ptr...
+			exprType = New TFunctionPtrType.Create(decl)
+			
 		Else
 		Else
 			args=CastArgs( args,decl )
 			args=CastArgs( args,decl )
 		End If
 		End If
@@ -1634,9 +1637,13 @@ Type TBinaryMathExpr Extends TBinaryExpr
 		If exprType Return Self
 		If exprType Return Self
 
 
 		lhs=lhs.Semant()
 		lhs=lhs.Semant()
+
+		If TIdentExpr(rhs) Then
+			TIdentExpr(rhs).isRhs = True
+		End If
+
 		rhs=rhs.Semant()
 		rhs=rhs.Semant()
 		
 		
-		
 		' operator overload?
 		' operator overload?
 		If TObjectType(lhs.exprType) Then
 		If TObjectType(lhs.exprType) Then
 			Local args:TExpr[] = [rhs]
 			Local args:TExpr[] = [rhs]

+ 5 - 0
type.bmx

@@ -1733,6 +1733,11 @@ End Type
 Type TFunctionPtrType Extends TType
 Type TFunctionPtrType Extends TType
 
 
 	Field func:TFuncDecl
 	Field func:TFuncDecl
+	
+	Method Create:TFunctionPtrType(func:TFuncDecl)
+		Self.func = func
+		Return Self
+	End Method
 
 
 	Method EqualsType:Int( ty:TType )
 	Method EqualsType:Int( ty:TType )
 ' TODO : compare function decl
 ' TODO : compare function decl