diff --git a/compiler/i386/n386cal.pas b/compiler/i386/n386cal.pas index cf27edac07..9000121264 100644 --- a/compiler/i386/n386cal.pas +++ b/compiler/i386/n386cal.pas @@ -510,7 +510,7 @@ implementation if inlined or (right=nil) then begin - { overloaded operator have no symtable } + { overloaded operator has no symtable } { push self } if assigned(symtableproc) and (symtableproc.symtabletype=withsymtable) then @@ -1584,7 +1584,14 @@ begin end. { $Log$ - Revision 1.28 2001-08-06 21:40:50 peter + Revision 1.29 2001-08-19 21:11:21 florian + * some bugs fix: + - overload; with external procedures fixed + - better selection of routine to do an overloaded + type case + - ... some more + + Revision 1.28 2001/08/06 21:40:50 peter * funcret moved from tprocinfo to tprocdef Revision 1.27 2001/07/08 21:00:16 peter diff --git a/compiler/ncal.pas b/compiler/ncal.pas index 50030cbb71..c28533e100 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -970,13 +970,13 @@ implementation end; { if there are several choices left then for orddef } - { if a type is totally included in the other } + { if a type is totally included in the other } { we don't fear an overflow , } - { so we can do as if it is an exact match } - { this will convert integer to longint } - { rather than to words } - { conversion of byte to integer or longint } - {would still not be solved } + { so we can do as if it is an exact match } + { this will convert integer to longint } + { rather than to words } + { conversion of byte to integer or longint } + { would still not be solved } if assigned(procs) and assigned(procs^.next) then begin hp:=procs; @@ -1687,7 +1687,14 @@ begin end. { $Log$ - Revision 1.41 2001-08-13 12:41:56 jonas + Revision 1.42 2001-08-19 21:11:20 florian + * some bugs fix: + - overload; with external procedures fixed + - better selection of routine to do an overloaded + type case + - ... some more + + Revision 1.41 2001/08/13 12:41:56 jonas * made code for str(x,y) completely processor independent Revision 1.40 2001/08/06 21:40:46 peter diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index ef852ec405..13b516d59f 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -919,6 +919,7 @@ end; procedure pd_overload; begin + include(aktprocsym.symoptions,sp_has_overloaded); end; procedure pd_message; @@ -1073,7 +1074,10 @@ begin current_module.uses_imports:=true; importlib.preparelib(current_module.modulename^); end; - if not(m_repeat_forward in aktmodeswitches) then + if not(m_repeat_forward in aktmodeswitches) and + { if the procedure is declared with the overload option } + { it requires a full declaration in the implementation part } + not(sp_has_overloaded in aktprocsym.symoptions) then begin { we can only have one overloaded here ! } if assigned(aktprocsym.definition.nextoverloaded) then @@ -1910,7 +1914,14 @@ const end. { $Log$ - Revision 1.32 2001-08-19 11:22:23 peter + Revision 1.33 2001-08-19 21:11:20 florian + * some bugs fix: + - overload; with external procedures fixed + - better selection of routine to do an overloaded + type case + - ... some more + + Revision 1.32 2001/08/19 11:22:23 peter * palmos support from v10 merged Revision 1.31 2001/08/05 13:18:50 peter diff --git a/compiler/symconst.pas b/compiler/symconst.pas index 16cf676ef4..8af170ffbd 100644 --- a/compiler/symconst.pas +++ b/compiler/symconst.pas @@ -111,6 +111,8 @@ type sp_hint_deprecated, sp_hint_platform, sp_hint_library + { is there any use for this constants } + { else sp_has_overloaded can be moved up FK } ,sp_7 ,sp_8 ,sp_9 @@ -129,6 +131,7 @@ type ,sp_22 ,sp_23 ,sp_24 + ,sp_has_overloaded ); tsymoptions=set of tsymoption; @@ -450,7 +453,14 @@ implementation end. { $Log$ - Revision 1.21 2001-08-01 15:07:29 jonas + Revision 1.22 2001-08-19 21:11:21 florian + * some bugs fix: + - overload; with external procedures fixed + - better selection of routine to do an overloaded + type case + - ... some more + + Revision 1.21 2001/08/01 15:07:29 jonas + "compilerproc" directive support, which turns both the public and mangled name to lowercase(declaration_name). This prevents a normal user from accessing the routine, but they can still be easily looked up within diff --git a/compiler/types.pas b/compiler/types.pas index b0c8c98481..62caa315f6 100644 --- a/compiler/types.pas +++ b/compiler/types.pas @@ -824,7 +824,10 @@ implementation begin if not explicit then begin - if (def.deftype=enumdef) or + if ((def.deftype=enumdef) and + { delphi allows range check errors in + enumeration type casts FK } + not(m_delphi in aktmodeswitches)) or (cs_check_range in aktlocalswitches) then Message(parser_e_range_check_error) else @@ -1202,14 +1205,41 @@ implementation passproc:=overloaded_operators[_ASSIGNMENT].definition else exit; + + { look for an exact match first } while passproc<>nil do begin if is_equal(passproc.rettype.def,to_def) and - (is_equal(TParaItem(passproc.Para.first).paratype.def,from_def) or - (isconvertable(from_def,TParaItem(passproc.Para.first).paratype.def,convtyp,ordconstn,false)=1)) then + (TParaItem(passproc.Para.first).paratype.def=from_def) then begin assignment_overloaded:=passproc; - break; + exit; + end; + passproc:=passproc.nextoverloaded; + end; + + passproc:=overloaded_operators[_ASSIGNMENT].definition; + { .... then look for an equal match } + while passproc<>nil do + begin + if is_equal(passproc.rettype.def,to_def) and + is_equal(TParaItem(passproc.Para.first).paratype.def,from_def) then + begin + assignment_overloaded:=passproc; + exit; + end; + passproc:=passproc.nextoverloaded; + end; + + passproc:=overloaded_operators[_ASSIGNMENT].definition; + { .... then for convert level 1 } + while passproc<>nil do + begin + if is_equal(passproc.rettype.def,to_def) and + (isconvertable(from_def,TParaItem(passproc.Para.first).paratype.def,convtyp,ordconstn,false)=1) then + begin + assignment_overloaded:=passproc; + exit; end; passproc:=passproc.nextoverloaded; end; @@ -1747,7 +1777,14 @@ implementation end. { $Log$ - Revision 1.44 2001-07-08 21:00:16 peter + Revision 1.45 2001-08-19 21:11:21 florian + * some bugs fix: + - overload; with external procedures fixed + - better selection of routine to do an overloaded + type case + - ... some more + + Revision 1.44 2001/07/08 21:00:16 peter * various widestring updates, it works now mostly without charset mapping supported