Răsfoiți Sursa

Added 'interfaces cannot have fields' check/error.

Mark Sibly 7 ani în urmă
părinte
comite
338d731889
1 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 3 2
      src/mx2cc/parser.monkey2

+ 3 - 2
src/mx2cc/parser.monkey2

@@ -187,8 +187,9 @@ Class Parser
 				Case "global"
 				Case "global"
 					ParseVars( decls,flags )
 					ParseVars( decls,flags )
 				Case "field"
 				Case "field"
-					If flags & DECL_EXTENSION Error( "Fields cannot be declared in extension classes" )
-					If fileScope Error( "Fields can only be declared inside a class, struct or interface" )
+					If flags & DECL_IFACEMEMBER Error( "Interfaces cannot have fields" )
+					If flags & DECL_EXTENSION Error( "Type extensions cannot have fields" )
+					If fileScope Error( "Fields must be declared within a class, struct or interface" )
 					ParseVars( decls,flags )
 					ParseVars( decls,flags )
 				Case "local"
 				Case "local"
 					Error( "Locals can only be declared in a statement block" )
 					Error( "Locals can only be declared in a statement block" )