2
0
Эх сурвалжийг харах

* assignment operator search finds best matching operator

git-svn-id: trunk@1469 -
peter 20 жил өмнө
parent
commit
7d153beac7
1 өөрчлөгдсөн 15 нэмэгдсэн , 5 устгасан
  1. 15 5
      compiler/symtable.pas

+ 15 - 5
compiler/symtable.pas

@@ -1847,11 +1847,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));
@@ -1861,12 +1865,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;