فهرست منبع

Fixes for Array casting.

woollybah 11 سال پیش
والد
کامیت
f7caf6e8de
1فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 12 2
      expr.bmx

+ 12 - 2
expr.bmx

@@ -1489,7 +1489,11 @@ Type TIdentTypeExpr Extends TExpr
 	Method _Semant()
 	Method _Semant()
 		If cdecl Return
 		If cdecl Return
 		exprType=exprType.Semant()
 		exprType=exprType.Semant()
-		cdecl=exprType.GetClass()
+		If TArrayType(exprType) And TObjectType(TArrayType(exprType).elemType) Then
+			cdecl=TObjectType(TArrayType(exprType).elemType).classDecl
+		Else
+			cdecl=exprType.GetClass()
+		End If
 		If Not cdecl InternalErr
 		If Not cdecl InternalErr
 	End Method
 	End Method
 
 
@@ -1500,7 +1504,13 @@ Type TIdentTypeExpr Extends TExpr
 
 
 	Method SemantFunc:TExpr( args:TExpr[] , throwError:Int = True, funcCall:Int = False )
 	Method SemantFunc:TExpr( args:TExpr[] , throwError:Int = True, funcCall:Int = False )
 		_Semant
 		_Semant
-		If args.Length=1 And args[0] Return args[0].Cast( cdecl.objectType,CAST_EXPLICIT )
+		If args.Length=1 And args[0] Then
+			If TArrayType(exprType) Then
+				Return args[0].Cast( exprType,CAST_EXPLICIT )
+			Else
+				Return args[0].Cast( cdecl.objectType,CAST_EXPLICIT )
+			End If
+		End If
 		Err "Illegal number of arguments for type conversion"
 		Err "Illegal number of arguments for type conversion"
 	End Method
 	End Method