Browse Source

compiler: global property can't be a class property

git-svn-id: trunk@20441 -
paul 13 years ago
parent
commit
d59c0237b2
2 changed files with 9 additions and 11 deletions
  1. 5 4
      compiler/pdecl.pas
  2. 4 7
      compiler/psub.pas

+ 5 - 4
compiler/pdecl.pas

@@ -44,7 +44,7 @@ interface
     procedure types_dec(in_structure: boolean);
     procedure types_dec(in_structure: boolean);
     procedure var_dec;
     procedure var_dec;
     procedure threadvar_dec;
     procedure threadvar_dec;
-    procedure property_dec(is_classpropery: boolean);
+    procedure property_dec;
     procedure resourcestring_dec;
     procedure resourcestring_dec;
 
 
 implementation
 implementation
@@ -773,9 +773,10 @@ implementation
       end;
       end;
 
 
 
 
-    procedure property_dec(is_classpropery: boolean);
+    procedure property_dec;
+    { parses a global property (fpc mode feature) }
       var
       var
-         old_block_type : tblock_type;
+         old_block_type: tblock_type;
       begin
       begin
          consume(_PROPERTY);
          consume(_PROPERTY);
          if not(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) then
          if not(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) then
@@ -783,7 +784,7 @@ implementation
          old_block_type:=block_type;
          old_block_type:=block_type;
          block_type:=bt_const;
          block_type:=bt_const;
          repeat
          repeat
-           read_property_dec(is_classpropery, nil);
+           read_property_dec(false, nil);
            consume(_SEMICOLON);
            consume(_SEMICOLON);
          until token<>_ID;
          until token<>_ID;
          block_type:=old_block_type;
          block_type:=old_block_type;

+ 4 - 7
compiler/psub.pas

@@ -1840,8 +1840,8 @@ implementation
                   if try_to_consume(_CLASS) then
                   if try_to_consume(_CLASS) then
                    begin
                    begin
                      { class modifier is only allowed for procedures, functions, }
                      { class modifier is only allowed for procedures, functions, }
-                     { constructors, destructors, fields and properties          }
-                     if not(token in [_FUNCTION,_PROCEDURE,_PROPERTY,_VAR,_CONSTRUCTOR,_DESTRUCTOR,_OPERATOR]) and
+                     { constructors, destructors                                 }
+                     if not(token in [_FUNCTION,_PROCEDURE,_CONSTRUCTOR,_DESTRUCTOR,_OPERATOR]) and
                         not((token=_ID) and (idtoken=_OPERATOR)) then
                         not((token=_ID) and (idtoken=_OPERATOR)) then
                        Message(parser_e_procedure_or_function_expected);
                        Message(parser_e_procedure_or_function_expected);
 
 
@@ -1902,10 +1902,7 @@ implementation
                     _PROPERTY:
                     _PROPERTY:
                       begin
                       begin
                         if (m_fpc in current_settings.modeswitches) then
                         if (m_fpc in current_settings.modeswitches) then
-                        begin
-                          property_dec(is_classdef);
-                          is_classdef:=false;
-                        end
+                          property_dec
                         else
                         else
                           break;
                           break;
                       end;
                       end;
@@ -1947,7 +1944,7 @@ implementation
                    _PROPERTY:
                    _PROPERTY:
                      begin
                      begin
                        if (m_fpc in current_settings.modeswitches) then
                        if (m_fpc in current_settings.modeswitches) then
-                         property_dec(false)
+                         property_dec
                        else
                        else
                          break;
                          break;
                      end;
                      end;