Преглед изворни кода

Fixed assignment of static arrays. Fixes #517.

Brucey пре 5 година
родитељ
комит
86c89ea837
2 измењених фајлова са 4 додато и 1 уклоњено
  1. 1 1
      parser.bmx
  2. 3 0
      stmt.bmx

+ 1 - 1
parser.bmx

@@ -1014,7 +1014,7 @@ Type TParser Extends TGenProcessor
 		
 		' array or function pointer?
 		Repeat
-			If (_toke = "[" Or _toke = "[]") And IsArrayDef() Then
+			If (_toke = "[" Or _toke = "[]") And (IsArrayDef() Or IsArrayDef(attr & DECL_STATIC > 0)) Then
 				If Not IsArrayDef(attr & DECL_STATIC > 0) Then
 					Err "Invalid static array initialization."
 				Else

+ 3 - 0
stmt.bmx

@@ -148,6 +148,9 @@ Type TAssignStmt Extends TStmt
 						Err "Cannot modify ReadOnly variable " + decl.ident
 					End If
 				End If
+				If TValDecl(decl) And TArrayType(TValDecl(decl).ty) And TArrayType(TValDecl(decl).ty).isStatic Then
+					Err "Static arrays cannot be assigned in this way."
+				End If
 			End If
 		
 			If IsPointerType(lhs.exprType, 0, TType.T_POINTER | TType.T_VARPTR) And TNumericType(rhs.exprType) Then