mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 22:29:45 +01: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; |         hp:=procs; | ||||||
|         while assigned(hp) do |         while assigned(hp) do | ||||||
|          begin |          begin | ||||||
|  |            { Setup first parameter to compare } | ||||||
|            currparanr:=paralength; |            currparanr:=paralength; | ||||||
|            currpara:=hp^.firstpara; |            currpara:=hp^.firstpara; | ||||||
|  |            while assigned(currpara) and (currpara.paratyp=vs_hidden) do | ||||||
|  |              currpara:=tparaitem(currpara.next); | ||||||
|            pt:=tcallparanode(left); |            pt:=tcallparanode(left); | ||||||
|            while assigned(pt) do |            while assigned(pt) and assigned(currpara) do | ||||||
|             begin |             begin | ||||||
|               { retrieve current parameter definitions to compares } |               { retrieve current parameter definitions to compares } | ||||||
|               def_from:=pt.resulttype.def; |               def_from:=pt.resulttype.def; | ||||||
|               def_to:=currpara.paratype.def; |               def_to:=currpara.paratype.def; | ||||||
| {$ifdef extdebug} |  | ||||||
|               if not(assigned(def_from)) then |               if not(assigned(def_from)) then | ||||||
|                internalerror(200212091); |                internalerror(200212091); | ||||||
|               if not( |               if not( | ||||||
| @ -1265,7 +1267,6 @@ type | |||||||
|                       (currparanr>hp^.data.minparacount)) |                       (currparanr>hp^.data.minparacount)) | ||||||
|                     ) then |                     ) then | ||||||
|                internalerror(200212092); |                internalerror(200212092); | ||||||
| {$endif extdebug} |  | ||||||
| 
 | 
 | ||||||
|               { varargs are always equal, but not exact } |               { varargs are always equal, but not exact } | ||||||
|               if (po_varargs in hp^.data.procoptions) and |               if (po_varargs in hp^.data.procoptions) and | ||||||
| @ -1289,9 +1290,9 @@ type | |||||||
|                  begin |                  begin | ||||||
|                    inc(hp^.equal_count); |                    inc(hp^.equal_count); | ||||||
|                    hp^.ordinal_distance:=hp^.ordinal_distance+ |                    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+ |                    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 |                  end | ||||||
|               else |               else | ||||||
|               { generic type comparision } |               { generic type comparision } | ||||||
| @ -1350,10 +1351,17 @@ type | |||||||
|                 if we're out of the varargs } |                 if we're out of the varargs } | ||||||
|               if not(po_varargs in hp^.data.procoptions) or |               if not(po_varargs in hp^.data.procoptions) or | ||||||
|                  (currparanr<=hp^.data.maxparacount) then |                  (currparanr<=hp^.data.maxparacount) then | ||||||
|  |                begin | ||||||
|  |                  { Ignore vs_hidden parameters } | ||||||
|  |                  repeat | ||||||
|                    currpara:=tparaitem(currpara.next); |                    currpara:=tparaitem(currpara.next); | ||||||
|  |                  until (not assigned(currpara)) or (currpara.paratyp<>vs_hidden); | ||||||
|  |                end; | ||||||
|               dec(currparanr); |               dec(currparanr); | ||||||
|             end; |             end; | ||||||
| 
 |            if not(hp^.invalid) and | ||||||
|  |               (assigned(pt) or assigned(currpara) or (currparanr<>0)) then | ||||||
|  |              internalerror(200212141); | ||||||
|            { next candidate } |            { next candidate } | ||||||
|            hp:=hp^.next; |            hp:=hp^.next; | ||||||
|          end; |          end; | ||||||
| @ -1497,6 +1505,8 @@ type | |||||||
| 
 | 
 | ||||||
|               { check the amount of parameters } |               { check the amount of parameters } | ||||||
|               pdc:=tparaitem(procdefinition.Para.first); |               pdc:=tparaitem(procdefinition.Para.first); | ||||||
|  |               while assigned(pdc) and (pdc.paratyp=vs_hidden) do | ||||||
|  |                 pdc:=tparaitem(pdc.next); | ||||||
|               pt:=tcallparanode(left); |               pt:=tcallparanode(left); | ||||||
|               lastpara:=paralength; |               lastpara:=paralength; | ||||||
|               while assigned(pdc) and assigned(pt) do |               while assigned(pdc) and assigned(pt) do | ||||||
| @ -1504,7 +1514,11 @@ type | |||||||
|                   { only goto next para if we're out of the varargs } |                   { only goto next para if we're out of the varargs } | ||||||
|                   if not(po_varargs in procdefinition.procoptions) or |                   if not(po_varargs in procdefinition.procoptions) or | ||||||
|                      (lastpara<=procdefinition.maxparacount) then |                      (lastpara<=procdefinition.maxparacount) then | ||||||
|  |                    begin | ||||||
|  |                      repeat | ||||||
|                        pdc:=tparaitem(pdc.next); |                        pdc:=tparaitem(pdc.next); | ||||||
|  |                      until (not assigned(pdc)) or (pdc.paratyp<>vs_hidden); | ||||||
|  |                    end; | ||||||
|                   pt:=tcallparanode(pt.right); |                   pt:=tcallparanode(pt.right); | ||||||
|                   dec(lastpara); |                   dec(lastpara); | ||||||
|                 end; |                 end; | ||||||
| @ -1633,7 +1647,7 @@ type | |||||||
|                  while assigned(pdc) do |                  while assigned(pdc) do | ||||||
|                   begin |                   begin | ||||||
|                     if not assigned(pdc.defaultvalue) then |                     if not assigned(pdc.defaultvalue) then | ||||||
|                      internalerror(751349858); |                      internalerror(200212142); | ||||||
|                     left:=ccallparanode.create(genconstsymtree(tconstsym(pdc.defaultvalue)),left); |                     left:=ccallparanode.create(genconstsymtree(tconstsym(pdc.defaultvalue)),left); | ||||||
|                     pdc:=tparaitem(pdc.previous); |                     pdc:=tparaitem(pdc.previous); | ||||||
|                   end; |                   end; | ||||||
| @ -2178,7 +2192,10 @@ begin | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * tcallnode.det_resulttype rewrite, merged code from nice_ncal and | ||||||
|       the old code. The new code collects the information about possible |       the old code. The new code collects the information about possible | ||||||
|       candidates only once resultting in much less calls to type compare |       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 |     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); |   targconvtyp = (act_convertable,act_equal,act_exact); | ||||||
| 
 | 
 | ||||||
| @ -339,7 +339,10 @@ implementation | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     + oo_dispinterface added | ||||||
| 
 | 
 | ||||||
|   Revision 1.37  2002/11/29 22:31:20  carl |   Revision 1.37  2002/11/29 22:31:20  carl | ||||||
|  | |||||||
| @ -3045,10 +3045,14 @@ implementation | |||||||
|         hp.paratype:=tt; |         hp.paratype:=tt; | ||||||
|         hp.defaultvalue:=defval; |         hp.defaultvalue:=defval; | ||||||
|         Para.insert(hp); |         Para.insert(hp); | ||||||
|  |         { Don't count hidden parameters } | ||||||
|  |         if (vsp<>vs_hidden) then | ||||||
|  |          begin | ||||||
|            if not assigned(defval) then |            if not assigned(defval) then | ||||||
|             inc(minparacount); |             inc(minparacount); | ||||||
|            inc(maxparacount); |            inc(maxparacount); | ||||||
|          end; |          end; | ||||||
|  |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -3109,9 +3113,13 @@ implementation | |||||||
|             hp.parasym:=tsym(ppufile.getderef); |             hp.parasym:=tsym(ppufile.getderef); | ||||||
|             { later, we'll gerate this on the fly (FK) } |             { later, we'll gerate this on the fly (FK) } | ||||||
|             ppufile.getdata(hp.paraloc,sizeof(tparalocation)); |             ppufile.getdata(hp.paraloc,sizeof(tparalocation)); | ||||||
|  |             { Don't count hidden parameters } | ||||||
|  |             if (hp.paratyp<>vs_hidden) then | ||||||
|  |              begin | ||||||
|                if not assigned(hp.defaultvalue) then |                if not assigned(hp.defaultvalue) then | ||||||
|                 inc(minparacount); |                 inc(minparacount); | ||||||
|                inc(maxparacount); |                inc(maxparacount); | ||||||
|  |              end; | ||||||
|             Para.concat(hp); |             Para.concat(hp); | ||||||
|           end; |           end; | ||||||
|       end; |       end; | ||||||
| @ -5514,7 +5522,10 @@ implementation | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * 3% memory optimization | ||||||
|     * changed some types |     * changed some types | ||||||
|     + added type checking with different size for call node and for |     + added type checking with different size for call node and for | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 peter
						peter