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

Moved ReadOnly to after Field keyword.

woollybah 7 жил өмнө
parent
commit
ae18b25bc6
1 өөрчлөгдсөн 9 нэмэгдсэн , 7 устгасан
  1. 9 7
      parser.bmx

+ 9 - 7
parser.bmx

@@ -2443,11 +2443,6 @@ End Rem
 				Err "Constants must be initialized."
 				Err "Constants must be initialized."
 			EndIf
 			EndIf
 			
 			
-			If toke = "field" Then
-				If CParse("readonly") Then
-					attrs :| DECL_READ_ONLY
-				End If
-			End If
 		EndIf
 		EndIf
 		
 		
 
 
@@ -2523,9 +2518,15 @@ End Rem
 		Return decl
 		Return decl
 	End Method
 	End Method
 
 
-	Method ParseDecls:TList( toke$,attrs:Int )
+	Method ParseDecls:TList( toke$,attrs:Int, isField:Int = False )
 		If toke Parse toke
 		If toke Parse toke
 
 
+		If isField Then
+			If CParse("readonly") Then
+				attrs :| DECL_READ_ONLY
+			End If
+		End If
+
 		Local decls:TList=New TList'<Decl>
 		Local decls:TList=New TList'<Decl>
 		Repeat
 		Repeat
 			Local decl:TDecl=ParseDecl( toke,attrs )
 			Local decl:TDecl=ParseDecl( toke,attrs )
@@ -3266,7 +3267,8 @@ End Rem
 				If (attrs & CLASS_STRUCT) And _toke<>"field"
 				If (attrs & CLASS_STRUCT) And _toke<>"field"
 					Err "Structs can only contain fields."
 					Err "Structs can only contain fields."
 				EndIf
 				EndIf
-				classDecl.InsertDecls ParseDecls( _toke,decl_attrs )
+				
+				classDecl.InsertDecls ParseDecls( _toke,decl_attrs, _toke = "field")
 			Case "method"
 			Case "method"
 				If (attrs & CLASS_STRUCT) And (attrs & DECL_EXTERN) Then
 				If (attrs & CLASS_STRUCT) And (attrs & DECL_EXTERN) Then
 					Err "Structs can only contain fields."
 					Err "Structs can only contain fields."