mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-23 12:51:47 +02:00
* ignore vs_hidden parameters when choosing overloaded proc
This commit is contained in:
parent
fc1b32c275
commit
a2a1a36e83
@ -1248,15 +1248,17 @@ type
|
||||
hp:=procs;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
{ Setup first parameter to compare }
|
||||
currparanr:=paralength;
|
||||
currpara:=hp^.firstpara;
|
||||
while assigned(currpara) and (currpara.paratyp=vs_hidden) do
|
||||
currpara:=tparaitem(currpara.next);
|
||||
pt:=tcallparanode(left);
|
||||
while assigned(pt) do
|
||||
while assigned(pt) and assigned(currpara) do
|
||||
begin
|
||||
{ retrieve current parameter definitions to compares }
|
||||
def_from:=pt.resulttype.def;
|
||||
def_to:=currpara.paratype.def;
|
||||
{$ifdef extdebug}
|
||||
if not(assigned(def_from)) then
|
||||
internalerror(200212091);
|
||||
if not(
|
||||
@ -1265,7 +1267,6 @@ type
|
||||
(currparanr>hp^.data.minparacount))
|
||||
) then
|
||||
internalerror(200212092);
|
||||
{$endif extdebug}
|
||||
|
||||
{ varargs are always equal, but not exact }
|
||||
if (po_varargs in hp^.data.procoptions) and
|
||||
@ -1289,9 +1290,9 @@ type
|
||||
begin
|
||||
inc(hp^.equal_count);
|
||||
hp^.ordinal_distance:=hp^.ordinal_distance+
|
||||
abs(bestreal(torddef(def_from).low-torddef(def_to).low));
|
||||
abs(bestreal(torddef(def_from).low)-bestreal(torddef(def_to).low));
|
||||
hp^.ordinal_distance:=hp^.ordinal_distance+
|
||||
abs(bestreal(torddef(def_to).high-torddef(def_from).high));
|
||||
abs(bestreal(torddef(def_to).high)-bestreal(torddef(def_from).high));
|
||||
end
|
||||
else
|
||||
{ generic type comparision }
|
||||
@ -1350,10 +1351,17 @@ type
|
||||
if we're out of the varargs }
|
||||
if not(po_varargs in hp^.data.procoptions) or
|
||||
(currparanr<=hp^.data.maxparacount) then
|
||||
currpara:=tparaitem(currpara.next);
|
||||
begin
|
||||
{ Ignore vs_hidden parameters }
|
||||
repeat
|
||||
currpara:=tparaitem(currpara.next);
|
||||
until (not assigned(currpara)) or (currpara.paratyp<>vs_hidden);
|
||||
end;
|
||||
dec(currparanr);
|
||||
end;
|
||||
|
||||
if not(hp^.invalid) and
|
||||
(assigned(pt) or assigned(currpara) or (currparanr<>0)) then
|
||||
internalerror(200212141);
|
||||
{ next candidate }
|
||||
hp:=hp^.next;
|
||||
end;
|
||||
@ -1497,6 +1505,8 @@ type
|
||||
|
||||
{ check the amount of parameters }
|
||||
pdc:=tparaitem(procdefinition.Para.first);
|
||||
while assigned(pdc) and (pdc.paratyp=vs_hidden) do
|
||||
pdc:=tparaitem(pdc.next);
|
||||
pt:=tcallparanode(left);
|
||||
lastpara:=paralength;
|
||||
while assigned(pdc) and assigned(pt) do
|
||||
@ -1504,7 +1514,11 @@ type
|
||||
{ only goto next para if we're out of the varargs }
|
||||
if not(po_varargs in procdefinition.procoptions) or
|
||||
(lastpara<=procdefinition.maxparacount) then
|
||||
pdc:=tparaitem(pdc.next);
|
||||
begin
|
||||
repeat
|
||||
pdc:=tparaitem(pdc.next);
|
||||
until (not assigned(pdc)) or (pdc.paratyp<>vs_hidden);
|
||||
end;
|
||||
pt:=tcallparanode(pt.right);
|
||||
dec(lastpara);
|
||||
end;
|
||||
@ -1633,7 +1647,7 @@ type
|
||||
while assigned(pdc) do
|
||||
begin
|
||||
if not assigned(pdc.defaultvalue) then
|
||||
internalerror(751349858);
|
||||
internalerror(200212142);
|
||||
left:=ccallparanode.create(genconstsymtree(tconstsym(pdc.defaultvalue)),left);
|
||||
pdc:=tparaitem(pdc.previous);
|
||||
end;
|
||||
@ -2178,7 +2192,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.117 2002-12-11 22:42:28 peter
|
||||
Revision 1.118 2002-12-15 11:26:02 peter
|
||||
* ignore vs_hidden parameters when choosing overloaded proc
|
||||
|
||||
Revision 1.117 2002/12/11 22:42:28 peter
|
||||
* tcallnode.det_resulttype rewrite, merged code from nice_ncal and
|
||||
the old code. The new code collects the information about possible
|
||||
candidates only once resultting in much less calls to type compare
|
||||
|
||||
@ -278,7 +278,7 @@ type
|
||||
vs_set_but_first_not_passed,vs_assigned,vs_used
|
||||
);
|
||||
|
||||
tvarspez = (vs_value,vs_const,vs_var,vs_out);
|
||||
tvarspez = (vs_value,vs_const,vs_var,vs_out,vs_hidden);
|
||||
|
||||
targconvtyp = (act_convertable,act_equal,act_exact);
|
||||
|
||||
@ -339,7 +339,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.38 2002-12-05 14:44:38 florian
|
||||
Revision 1.39 2002-12-15 11:26:02 peter
|
||||
* ignore vs_hidden parameters when choosing overloaded proc
|
||||
|
||||
Revision 1.38 2002/12/05 14:44:38 florian
|
||||
+ oo_dispinterface added
|
||||
|
||||
Revision 1.37 2002/11/29 22:31:20 carl
|
||||
|
||||
@ -522,7 +522,7 @@ interface
|
||||
procedure setmangledname(const s : string);
|
||||
procedure load_references(ppufile:tcompilerppufile;locals:boolean);
|
||||
function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
|
||||
{ inserts the local symbol table, if this is not
|
||||
{ inserts the local symbol table, if this is not
|
||||
no local symbol table is built. Should be called only
|
||||
when we are sure that a local symbol table will be required.
|
||||
}
|
||||
@ -3045,9 +3045,13 @@ implementation
|
||||
hp.paratype:=tt;
|
||||
hp.defaultvalue:=defval;
|
||||
Para.insert(hp);
|
||||
if not assigned(defval) then
|
||||
inc(minparacount);
|
||||
inc(maxparacount);
|
||||
{ Don't count hidden parameters }
|
||||
if (vsp<>vs_hidden) then
|
||||
begin
|
||||
if not assigned(defval) then
|
||||
inc(minparacount);
|
||||
inc(maxparacount);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -3109,9 +3113,13 @@ implementation
|
||||
hp.parasym:=tsym(ppufile.getderef);
|
||||
{ later, we'll gerate this on the fly (FK) }
|
||||
ppufile.getdata(hp.paraloc,sizeof(tparalocation));
|
||||
if not assigned(hp.defaultvalue) then
|
||||
inc(minparacount);
|
||||
inc(maxparacount);
|
||||
{ Don't count hidden parameters }
|
||||
if (hp.paratyp<>vs_hidden) then
|
||||
begin
|
||||
if not assigned(hp.defaultvalue) then
|
||||
inc(minparacount);
|
||||
inc(maxparacount);
|
||||
end;
|
||||
Para.concat(hp);
|
||||
end;
|
||||
end;
|
||||
@ -5514,7 +5522,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.115 2002-12-07 14:27:09 carl
|
||||
Revision 1.116 2002-12-15 11:26:02 peter
|
||||
* ignore vs_hidden parameters when choosing overloaded proc
|
||||
|
||||
Revision 1.115 2002/12/07 14:27:09 carl
|
||||
* 3% memory optimization
|
||||
* changed some types
|
||||
+ added type checking with different size for call node and for
|
||||
|
||||
Loading…
Reference in New Issue
Block a user