compiler: support *sealed* and *abstract* for objects (issue #0016174)

git-svn-id: trunk@15105 -
This commit is contained in:
paul 2010-04-01 14:36:33 +00:00
parent 02069109d1
commit 8a0028a62e
4 changed files with 39 additions and 2 deletions

2
.gitattributes vendored
View File

@ -9286,6 +9286,8 @@ tests/test/tsealed1.pp svneol=native#text/pascal
tests/test/tsealed2.pp svneol=native#text/pascal
tests/test/tsealed3.pp svneol=native#text/pascal
tests/test/tsealed4.pp svneol=native#text/pascal
tests/test/tsealed5.pp svneol=native#text/pascal
tests/test/tsealed6.pp svneol=native#text/pascal
tests/test/tsel1.pp svneol=native#text/plain
tests/test/tsel2.pp svneol=native#text/plain
tests/test/tset1.pp svneol=native#text/plain

View File

@ -284,7 +284,7 @@ implementation
procedure parse_object_options;
begin
if current_objectdef.objecttype = odt_class then
if current_objectdef.objecttype in [odt_object,odt_class] then
begin
while true do
begin
@ -389,7 +389,10 @@ implementation
end;
odt_object:
if not(is_object(childof)) then
Message(parser_e_mix_of_classes_and_objects);
Message(parser_e_mix_of_classes_and_objects)
else
if oo_is_sealed in childof.objectoptions then
Message1(parser_e_sealed_descendant,childof.typename);
odt_dispinterface:
Message(parser_e_dispinterface_cant_have_parent);
end;

17
tests/test/tsealed5.pp Normal file
View File

@ -0,0 +1,17 @@
{ %fail }
{$ifdef fpc}
{$mode objfpc}
{$endif}
type
TSealedObject = object sealed
public
end;
TSealedDesdentantObject = object(TSealedObject)
public
end;
begin
end.

15
tests/test/tsealed6.pp Normal file
View File

@ -0,0 +1,15 @@
{$ifdef fpc}
{$mode objfpc}
{$endif}
type
TAbstractObject = object abstract abstract abstract
public
end;
TSealedObject = object sealed sealed sealed
public
end;
begin
end.