浏览代码

Added 'interfaces cannot have fields' check/error.

Mark Sibly 7 年之前
父节点
当前提交
338d731889
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/mx2cc/parser.monkey2

+ 3 - 2
src/mx2cc/parser.monkey2

@@ -187,8 +187,9 @@ Class Parser
 				Case "global"
 					ParseVars( decls,flags )
 				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 )
 				Case "local"
 					Error( "Locals can only be declared in a statement block" )