Browse Source

Fixed static array field initialisers. Fixes #518.

Brucey 5 years ago
parent
commit
70ab7371ab
1 changed files with 6 additions and 2 deletions
  1. 6 2
      ctranslator.bmx

+ 6 - 2
ctranslator.bmx

@@ -3577,7 +3577,7 @@ End Rem
 					Local t:String = TransType(decl.ty, classDecl.actual.munged) + " _" + classDecl.actual.munged.ToLower() + "_" + decl.IdentLower()
 					Local t:String = TransType(decl.ty, classDecl.actual.munged) + " _" + classDecl.actual.munged.ToLower() + "_" + decl.IdentLower()
 					
 					
 					If TArrayType(decl.ty) And TArrayType(decl.ty).isStatic Then
 					If TArrayType(decl.ty) And TArrayType(decl.ty).isStatic Then
-						t :+ "[" + decl.init.Trans() + "]"
+						t :+ "[" + TArrayType(decl.ty).length + "]"
 					End If
 					End If
 					
 					
 					Emit t + ";"
 					Emit t + ";"
@@ -4909,7 +4909,11 @@ End Rem
 					Else If TStringType(decl.ty) Then
 					Else If TStringType(decl.ty) Then
 						fld :+ "= &bbEmptyString;"
 						fld :+ "= &bbEmptyString;"
 					Else If TArrayType(decl.ty) Then
 					Else If TArrayType(decl.ty) Then
-						fld :+ "= &bbEmptyArray;"
+						If TArrayType(decl.ty).isStatic Then
+							doEmit = False
+						Else
+							fld :+ "= &bbEmptyArray;"
+						End If
 					Else If TEnumType(decl.ty) Then
 					Else If TEnumType(decl.ty) Then
 						fld :+ "= " + TEnumType(decl.ty).decl.values[0].Value() + ";"
 						fld :+ "= " + TEnumType(decl.ty).decl.values[0].Value() + ";"
 					End If
 					End If