+ parsing of type casts with nested types

git-svn-id: trunk@5335 -
This commit is contained in:
florian 2006-11-11 20:45:02 +00:00
parent 534048e286
commit 80876932aa
2 changed files with 16 additions and 3 deletions

View File

@ -2137,7 +2137,19 @@ implementation
begin
if assigned(getprocvardef) and
equal_defs(p1.resultdef,getprocvardef) then
again:=false
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
end
else
begin
if try_to_consume(_LKLAMMER) then

View File

@ -4,7 +4,7 @@ type
generic TList<_T>=class(TObject)
type public
TCompareFunc = function(const Item1, Item2: _T): Integer;
var public
var public
data : _T;
compare : TCompareFunc;
procedure Add(item: _T);
@ -17,7 +17,7 @@ begin
halt(1);
end;
function CompareInt(Item1, Item2: Integer): Integer;
function CompareInt(const Item1, Item2: Integer): Integer;
begin
Result := Item2 - Item1;
end;
@ -33,4 +33,5 @@ begin
ilist := TMyIntList.Create;
ilist.compare := ilist.TCompareFunc(@CompareInt);
ilist.add(someInt);
writeln('ok');
end.