Ver código fonte

Fixes an issue handling negative enum.

Brucey 3 meses atrás
pai
commit
46f96f3506
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      decl.bmx

+ 5 - 1
decl.bmx

@@ -501,7 +501,11 @@ Type TValDecl Extends TDecl
 		' for imported enum args with a default value, we need to set the type of the value to the enum
 		' for imported enum args with a default value, we need to set the type of the value to the enum
 		' since at this point it's just a number with no context
 		' since at this point it's just a number with no context
 		If TArgDecl(Self) And declInit And scope And scope.declImported And TEnumType(ty) Then
 		If TArgDecl(Self) And declInit And scope And scope.declImported And TEnumType(ty) Then
-			declInit = New TConstExpr.Create(ty, TConstExpr(declInit).value).Semant()
+			If TConstExpr(declInit) Then
+				declInit = New TConstExpr.Create(ty, TConstExpr(declInit).value).Semant()
+			Else If TUnaryExpr(declInit) Then
+				declInit = New TConstExpr.Create(ty, TUnaryExpr(declInit).Eval()).Semant()
+			End If
 		End If
 		End If
 			
 			
 		If declTy
 		If declTy