浏览代码

Merged revisions 1469 via svnmerge from
http://[email protected]/svn/fpc/trunk

r1469 (peter)
* assignment operator search finds best matching operator

git-svn-id: branches/fixes_2_0@1507 -

peter 20 年之前
父节点
当前提交
742bac98ea
共有 1 个文件被更改,包括 15 次插入5 次删除
  1. 15 5
      compiler/symtable.pas

+ 15 - 5
compiler/symtable.pas

@@ -2061,11 +2061,15 @@ implementation
     var st:Tsymtable;
         sym:Tprocsym;
         sv:cardinal;
-        besteq:tequaltype;
-
+        curreq,
+        besteq : tequaltype;
+        currpd,
+        bestpd : tprocdef;
     begin
       st:=symtablestack;
       sv:=getspeedvalue('assign');
+      besteq:=te_incompatible;
+      bestpd:=nil;
       while st<>nil do
         begin
           sym:=Tprocsym(st.speedsearch('assign',sv));
@@ -2075,12 +2079,18 @@ implementation
                 internalerror(200402031);
               { if the source type is an alias then this is only the second choice,
                 if you mess with this code, check tw4093 }
-              search_assignment_operator:=sym.search_procdef_assignment_operator(from_def,to_def,besteq);
-              if (search_assignment_operator<>nil) and (besteq=te_exact) then
-                break;
+              currpd:=sym.search_procdef_assignment_operator(from_def,to_def,curreq);
+              if curreq>besteq then
+                begin
+                  besteq:=curreq;
+                  bestpd:=currpd;
+                  if (besteq=te_exact) then
+                    break;
+                end;
             end;
           st:=st.next;
         end;
+      result:=bestpd;
     end;
 
     function searchsystype(const s: stringid; var srsym: ttypesym): boolean;