mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:29:21 +02:00
* assignment operator search finds best matching operator
git-svn-id: trunk@1469 -
This commit is contained in:
parent
45fbeaad53
commit
7d153beac7
@ -1847,11 +1847,15 @@ implementation
|
|||||||
var st:Tsymtable;
|
var st:Tsymtable;
|
||||||
sym:Tprocsym;
|
sym:Tprocsym;
|
||||||
sv:cardinal;
|
sv:cardinal;
|
||||||
besteq:tequaltype;
|
curreq,
|
||||||
|
besteq : tequaltype;
|
||||||
|
currpd,
|
||||||
|
bestpd : tprocdef;
|
||||||
begin
|
begin
|
||||||
st:=symtablestack;
|
st:=symtablestack;
|
||||||
sv:=getspeedvalue('assign');
|
sv:=getspeedvalue('assign');
|
||||||
|
besteq:=te_incompatible;
|
||||||
|
bestpd:=nil;
|
||||||
while st<>nil do
|
while st<>nil do
|
||||||
begin
|
begin
|
||||||
sym:=Tprocsym(st.speedsearch('assign',sv));
|
sym:=Tprocsym(st.speedsearch('assign',sv));
|
||||||
@ -1861,12 +1865,18 @@ implementation
|
|||||||
internalerror(200402031);
|
internalerror(200402031);
|
||||||
{ if the source type is an alias then this is only the second choice,
|
{ if the source type is an alias then this is only the second choice,
|
||||||
if you mess with this code, check tw4093 }
|
if you mess with this code, check tw4093 }
|
||||||
search_assignment_operator:=sym.search_procdef_assignment_operator(from_def,to_def,besteq);
|
currpd:=sym.search_procdef_assignment_operator(from_def,to_def,curreq);
|
||||||
if (search_assignment_operator<>nil) and (besteq=te_exact) then
|
if curreq>besteq then
|
||||||
|
begin
|
||||||
|
besteq:=curreq;
|
||||||
|
bestpd:=currpd;
|
||||||
|
if (besteq=te_exact) then
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
st:=st.next;
|
st:=st.next;
|
||||||
end;
|
end;
|
||||||
|
result:=bestpd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function searchsystype(const s: stringid; var srsym: ttypesym): boolean;
|
function searchsystype(const s: stringid; var srsym: ttypesym): boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user