mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:09:07 +02:00
fixes bug #4093
+ variant -> tdatetime implemented + overloaded assignment operator takes care of unique flags git-svn-id: trunk@508 -
This commit is contained in:
parent
fee6627a8a
commit
067a39a7f9
@ -123,7 +123,7 @@ interface
|
|||||||
function search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
|
function search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
|
||||||
function search_procdef_bypara(para:tlist;retdef:tdef;cpoptions:tcompare_paras_options):Tprocdef;
|
function search_procdef_bypara(para:tlist;retdef:tdef;cpoptions:tcompare_paras_options):Tprocdef;
|
||||||
function search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
|
function search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
|
||||||
function search_procdef_assignment_operator(fromdef,todef:tdef):Tprocdef;
|
function search_procdef_assignment_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef;
|
||||||
function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
|
function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
|
||||||
function is_visible_for_object(currobjdef:tdef):boolean;override;
|
function is_visible_for_object(currobjdef:tdef):boolean;override;
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
@ -988,13 +988,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function Tprocsym.search_procdef_assignment_operator(fromdef,todef:tdef):Tprocdef;
|
function Tprocsym.search_procdef_assignment_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef;
|
||||||
var
|
var
|
||||||
convtyp : tconverttype;
|
convtyp : tconverttype;
|
||||||
pd : pprocdeflist;
|
pd : pprocdeflist;
|
||||||
bestpd : tprocdef;
|
bestpd : tprocdef;
|
||||||
eq,
|
eq : tequaltype;
|
||||||
besteq : tequaltype;
|
|
||||||
hpd : tprocdef;
|
hpd : tprocdef;
|
||||||
i : byte;
|
i : byte;
|
||||||
begin
|
begin
|
||||||
@ -1004,7 +1003,15 @@ implementation
|
|||||||
pd:=pdlistfirst;
|
pd:=pdlistfirst;
|
||||||
while assigned(pd) do
|
while assigned(pd) do
|
||||||
begin
|
begin
|
||||||
if equal_defs(todef,pd^.def.rettype.def) then
|
if equal_defs(todef,pd^.def.rettype.def) and
|
||||||
|
{ the result type must be always really equal and not an alias,
|
||||||
|
if you mess with this code, check tw4093 }
|
||||||
|
((todef=pd^.def.rettype.def) or
|
||||||
|
(
|
||||||
|
not(df_unique in todef.defoptions) and
|
||||||
|
not(df_unique in pd^.def.rettype.def.defoptions)
|
||||||
|
)
|
||||||
|
) then
|
||||||
begin
|
begin
|
||||||
i:=0;
|
i:=0;
|
||||||
{ ignore vs_hidden parameters }
|
{ ignore vs_hidden parameters }
|
||||||
@ -1014,8 +1021,18 @@ implementation
|
|||||||
if assigned(pd^.def.paras[i]) then
|
if assigned(pd^.def.paras[i]) then
|
||||||
begin
|
begin
|
||||||
eq:=compare_defs_ext(fromdef,tparavarsym(pd^.def.paras[i]).vartype.def,nothingn,convtyp,hpd,[]);
|
eq:=compare_defs_ext(fromdef,tparavarsym(pd^.def.paras[i]).vartype.def,nothingn,convtyp,hpd,[]);
|
||||||
|
|
||||||
|
{ alias? if yes, only l1 choice,
|
||||||
|
if you mess with this code, check tw4093 }
|
||||||
|
if (eq=te_exact) and
|
||||||
|
(fromdef<>tparavarsym(pd^.def.paras[i]).vartype.def) and
|
||||||
|
((df_unique in fromdef.defoptions) or
|
||||||
|
(df_unique in tparavarsym(pd^.def.paras[i]).vartype.def.defoptions)) then
|
||||||
|
eq:=te_convert_l1;
|
||||||
|
|
||||||
if eq=te_exact then
|
if eq=te_exact then
|
||||||
begin
|
begin
|
||||||
|
besteq:=eq;
|
||||||
result:=pd^.def;
|
result:=pd^.def;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -2051,6 +2051,7 @@ implementation
|
|||||||
var st:Tsymtable;
|
var st:Tsymtable;
|
||||||
sym:Tprocsym;
|
sym:Tprocsym;
|
||||||
sv:cardinal;
|
sv:cardinal;
|
||||||
|
besteq:tequaltype;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
st:=symtablestack;
|
st:=symtablestack;
|
||||||
@ -2062,8 +2063,10 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if sym.typ<>procsym then
|
if sym.typ<>procsym then
|
||||||
internalerror(200402031);
|
internalerror(200402031);
|
||||||
search_assignment_operator:=sym.search_procdef_assignment_operator(from_def,to_def);
|
{ if the source type is an alias then this is only the second choice,
|
||||||
if search_assignment_operator<>nil then
|
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;
|
break;
|
||||||
end;
|
end;
|
||||||
st:=st.next;
|
st:=st.next;
|
||||||
|
@ -25,5 +25,4 @@ begin
|
|||||||
writeln(v);
|
writeln(v);
|
||||||
DT := V;
|
DT := V;
|
||||||
WriteLn(DateTimeToStr(DT));
|
WriteLn(DateTimeToStr(DT));
|
||||||
ReadLn;
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user