mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 15:59:28 +01:00 
			
		
		
		
	+ parsing of type casts with nested types
git-svn-id: trunk@5335 -
This commit is contained in:
		
							parent
							
								
									534048e286
								
							
						
					
					
						commit
						80876932aa
					
				@ -2137,7 +2137,19 @@ implementation
 | 
				
			|||||||
                     begin
 | 
					                     begin
 | 
				
			||||||
                       if assigned(getprocvardef) and
 | 
					                       if assigned(getprocvardef) and
 | 
				
			||||||
                          equal_defs(p1.resultdef,getprocvardef) then
 | 
					                          equal_defs(p1.resultdef,getprocvardef) then
 | 
				
			||||||
 | 
					                         begin
 | 
				
			||||||
 | 
					                           { classes can define now types so we've to allow
 | 
				
			||||||
 | 
					                             type casts with these nested types as well }
 | 
				
			||||||
 | 
					                           if (p1.nodetype=typen) and
 | 
				
			||||||
 | 
					                              try_to_consume(_LKLAMMER) then
 | 
				
			||||||
 | 
					                             begin
 | 
				
			||||||
 | 
					                               p1:=comp_expr(true);
 | 
				
			||||||
 | 
					                               consume(_RKLAMMER);
 | 
				
			||||||
 | 
					                               p1:=ctypeconvnode.create_explicit(p1,p1.resultdef);
 | 
				
			||||||
 | 
					                             end
 | 
				
			||||||
 | 
					                           else
 | 
				
			||||||
                             again:=false
 | 
					                             again:=false
 | 
				
			||||||
 | 
					                         end
 | 
				
			||||||
                       else
 | 
					                       else
 | 
				
			||||||
                         begin
 | 
					                         begin
 | 
				
			||||||
                           if try_to_consume(_LKLAMMER) then
 | 
					                           if try_to_consume(_LKLAMMER) then
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ begin
 | 
				
			|||||||
    halt(1);
 | 
					    halt(1);
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function CompareInt(Item1, Item2: Integer): Integer;
 | 
					function CompareInt(const Item1, Item2: Integer): Integer;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  Result := Item2 - Item1;
 | 
					  Result := Item2 - Item1;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
@ -33,4 +33,5 @@ begin
 | 
				
			|||||||
  ilist := TMyIntList.Create;
 | 
					  ilist := TMyIntList.Create;
 | 
				
			||||||
  ilist.compare := ilist.TCompareFunc(@CompareInt);
 | 
					  ilist.compare := ilist.TCompareFunc(@CompareInt);
 | 
				
			||||||
  ilist.add(someInt);
 | 
					  ilist.add(someInt);
 | 
				
			||||||
 | 
					  writeln('ok');
 | 
				
			||||||
end.
 | 
					end.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user