* fixed some vmt problems, especially related to overloaded methods

in objects/classes
This commit is contained in:
florian 2000-05-11 06:53:48 +00:00
parent e112b16a51
commit 889e43db8a
3 changed files with 60 additions and 16 deletions

View File

@ -85,3 +85,5 @@ Changes in the syntax or semantic of FPC:
29/02/00 ORDERSOURCES released => PPU version change
this allows for a more correct include file hunting order.
01/04/00 fix the handling of value parameters in cdecl function
11/05/00 changed vmt handling to fix problems some problems
with overloading in objects

View File

@ -467,6 +467,35 @@ implementation
end;
end;
procedure newdefentry;
begin
new(procdefcoll);
procdefcoll^.data:=hp;
procdefcoll^.next:=symcoll^.data;
symcoll^.data:=procdefcoll;
{ if it's a virtual method }
if (po_virtualmethod in hp^.procoptions) then
begin
{ then it gets a number ... }
hp^.extnumber:=nextvirtnumber;
{ and we inc the number }
inc(nextvirtnumber);
has_virtual_method:=true;
end;
if (hp^.proctypeoption=potype_constructor) then
has_constructor:=true;
{ check, if a method should be overridden }
if (po_overridingmethod in hp^.procoptions) then
MessagePos1(hp^.fileinfo,parser_e_nothing_to_be_overridden,_c^.objname^+'.'+_name+hp^.demangled_paras);
end;
label
handlenextdef;
begin
{ put only sub routines into the VMT }
if psym(sym)^.typ=procsym then
@ -507,8 +536,6 @@ implementation
we hide the method }
if _c=hp^._class then
Message1(parser_w_should_use_override,_c^.objname^+'.'+_name);
newentry;
exit;
end
else
if _c=hp^._class then
@ -518,9 +545,10 @@ implementation
else
Message1(parser_w_overloaded_are_not_both_non_virtual,
_c^.objname^+'.'+_name);
newentry;
exit;
end;
{ was newentry; exit; (FK) }
newdefentry;
goto handlenextdef;
end
else
{ the flags have to match }
@ -544,7 +572,8 @@ implementation
we hide the method }
if _c=hp^._class then
Message1(parser_w_should_use_override,_c^.objname^+'.'+_name);
newentry;
{ was newentry; (FK) }
newdefentry;
exit;
end;
@ -564,6 +593,7 @@ implementation
{ and exchange }
procdefcoll^.data:=hp;
stored:=true;
goto handlenextdef;
end; { same parameters }
procdefcoll:=procdefcoll^.next;
end;
@ -587,6 +617,7 @@ implementation
MessagePos1(hp^.fileinfo,parser_e_nothing_to_be_overridden,
_c^.objname^+'.'+_name+hp^.demangled_paras);
end;
handlenextdef:
hp:=hp^.nextoverloaded;
end;
exit;
@ -608,9 +639,12 @@ implementation
{ walk through all public syms }
{ I had to change that to solve bug0260 (PM)}
{_c:=_class;}
_c:=p;
{ Florian, please check if you agree (PM) }
{ _c:=p; }
_c:=_class;
{ Florian, please check if you agree (PM) }
{ no it wasn't correct, but I fixed it at }
{ another place: your fix hides only a bug }
{ _c is only used to give correct warnings }
p^.symtable^.foreach({$ifndef TP}@{$endif}eachsym);
end;
@ -697,7 +731,11 @@ implementation
end.
{
$Log$
Revision 1.27 2000-04-29 12:49:30 peter
Revision 1.28 2000-05-11 06:55:28 florian
* fixed some vmt problems, especially related to overloaded methods
in objects/classes
Revision 1.27 2000/04/29 12:49:30 peter
* fixed long line for tp7
Revision 1.26 2000/03/06 15:57:42 peter
@ -746,4 +784,4 @@ end.
* moved bitmask constants to sets
* some other type/const renamings
}
}

View File

@ -44,15 +44,15 @@ type
const
{$ifdef newcg}
{$ifdef ORDERSOURCES}
CurrentPPUVersion=101;
CurrentPPUVersion=103;
{$else ORDERSOURCES}
CurrentPPUVersion=100;
CurrentPPUVersion=102;
{$endif ORDERSOURCES}
{$else newcg}
{$ifdef ORDERSOURCES}
CurrentPPUVersion=19;
CurrentPPUVersion=21;
{$else ORDERSOURCES}
CurrentPPUVersion=18;
CurrentPPUVersion=20;
{$endif ORDERSOURCES}
{$endif newcg}
@ -1006,7 +1006,11 @@ end;
end.
{
$Log$
Revision 1.56 2000-02-29 21:58:31 pierre
Revision 1.57 2000-05-11 06:54:29 florian
* fixed some vmt problems, especially related to overloaded methods
in objects/classes
Revision 1.56 2000/02/29 21:58:31 pierre
* ORDERSOURCES released
Revision 1.55 2000/02/09 13:22:59 peter
@ -1078,4 +1082,4 @@ end.
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
}
}