compiler: reset section type to regular fields section after the "public", "protected", ... and other section visibility keywords

git-svn-id: trunk@16302 -
This commit is contained in:
paul 2010-11-04 15:12:17 +00:00
parent 71aa7eaabd
commit f5751d81db
3 changed files with 32 additions and 0 deletions

1
.gitattributes vendored
View File

@ -9158,6 +9158,7 @@ tests/test/tclass1.pp svneol=native#text/plain
tests/test/tclass10.pp svneol=native#text/pascal
tests/test/tclass10a.pp svneol=native#text/pascal
tests/test/tclass10b.pp svneol=native#text/pascal
tests/test/tclass10c.pp svneol=native#text/pascal
tests/test/tclass11a.pp svneol=native#text/pascal
tests/test/tclass11b.pp svneol=native#text/pascal
tests/test/tclass12a.pp svneol=native#text/pascal

View File

@ -650,6 +650,8 @@ implementation
current_objectdef.symtable.currentvisibility:=vis_private;
include(current_objectdef.objectoptions,oo_has_private);
fields_allowed:=true;
is_classdef:=false;
classfields:=false;
object_member_blocktype:=bt_general;
end;
_PROTECTED :
@ -661,6 +663,8 @@ implementation
current_objectdef.symtable.currentvisibility:=vis_protected;
include(current_objectdef.objectoptions,oo_has_protected);
fields_allowed:=true;
is_classdef:=false;
classfields:=false;
object_member_blocktype:=bt_general;
end;
_PUBLIC :
@ -671,6 +675,8 @@ implementation
consume(_PUBLIC);
current_objectdef.symtable.currentvisibility:=vis_public;
fields_allowed:=true;
is_classdef:=false;
classfields:=false;
object_member_blocktype:=bt_general;
end;
_PUBLISHED :
@ -687,6 +693,8 @@ implementation
consume(_PUBLISHED);
current_objectdef.symtable.currentvisibility:=vis_published;
fields_allowed:=true;
is_classdef:=false;
classfields:=false;
object_member_blocktype:=bt_general;
end;
_STRICT :
@ -717,6 +725,8 @@ implementation
else
message(parser_e_protected_or_private_expected);
fields_allowed:=true;
is_classdef:=false;
classfields:=false;
object_member_blocktype:=bt_general;
end
else

21
tests/test/tclass10c.pp Normal file
View File

@ -0,0 +1,21 @@
program tclass10c;
{$ifdef fpc}
{$mode delphi}
{$endif}
// check that "protected" or any other section resets the section type to accept regular fields
type
Tfoo=class
private
class var
f1: Integer;
protected
f2: Integer;
public
class property pf1: Integer read f1;
property pf2: Integer read f2;
end;
begin
end.