mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 07:43:04 +01:00 
			
		
		
		
	compiler: support *sealed* and *abstract* for objects (issue #0016174)
git-svn-id: trunk@15105 -
This commit is contained in:
		
							parent
							
								
									02069109d1
								
							
						
					
					
						commit
						8a0028a62e
					
				
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
									
								
							
							
						
						
									
										17
									
								
								tests/test/tsealed5.pp
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										15
									
								
								tests/test/tsealed6.pp
									
									
									
									
									
										Normal 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.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user