mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 14:19:31 +02:00
* give ord->formaldef again a higher precedence than ord->floatdef
(last convert level that is added, needs a more structural solution) git-svn-id: trunk@9057 -
This commit is contained in:
parent
7453e2a72d
commit
e716ac6b6b
@ -252,7 +252,7 @@ implementation
|
||||
eq:=te_incompatible
|
||||
else if (not is_in_limit(def_from,def_to)) then
|
||||
{ "punish" bad type conversions :) (JM) }
|
||||
eq:=te_convert_l2
|
||||
eq:=te_convert_l3
|
||||
else
|
||||
eq:=te_convert_l1;
|
||||
end;
|
||||
@ -505,7 +505,7 @@ implementation
|
||||
(s64currencytype.typ = floatdef))) then
|
||||
begin
|
||||
doconv:=tc_int_2_real;
|
||||
eq:=te_convert_l3;
|
||||
eq:=te_convert_l4;
|
||||
end
|
||||
else if is_currency(def_from)
|
||||
{ and (s64currencytype.typ = orddef)) } then
|
||||
@ -906,7 +906,7 @@ implementation
|
||||
if (m_delphi in current_settings.modeswitches) and is_integer(def_from) then
|
||||
begin
|
||||
doconv:=tc_cord_2_pointer;
|
||||
eq:=te_convert_l4;
|
||||
eq:=te_convert_l5;
|
||||
end;
|
||||
end;
|
||||
{ allow explicit typecasts from ordinals to pointer.
|
||||
|
@ -49,6 +49,7 @@ interface
|
||||
cl2_count,
|
||||
cl3_count,
|
||||
cl4_count,
|
||||
cl5_count,
|
||||
coper_count : integer; { should be signed }
|
||||
ordinal_distance : double;
|
||||
invalid : boolean;
|
||||
@ -1900,6 +1901,7 @@ implementation
|
||||
' l2: '+tostr(hp^.cl2_count)+
|
||||
' l3: '+tostr(hp^.cl3_count)+
|
||||
' l4: '+tostr(hp^.cl4_count)+
|
||||
' l5: '+tostr(hp^.cl5_count)+
|
||||
' oper: '+tostr(hp^.coper_count)+
|
||||
' ord: '+realtostr(hp^.ordinal_distance));
|
||||
{ Print parameters in left-right order }
|
||||
@ -2134,6 +2136,8 @@ implementation
|
||||
inc(hp^.cl3_count);
|
||||
te_convert_l4 :
|
||||
inc(hp^.cl4_count);
|
||||
te_convert_l5 :
|
||||
inc(hp^.cl5_count);
|
||||
te_convert_operator :
|
||||
inc(hp^.coper_count);
|
||||
te_incompatible :
|
||||
@ -2259,43 +2263,48 @@ implementation
|
||||
res:=(bestpd^.coper_count-currpd^.coper_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl4 parameters? }
|
||||
res:=(bestpd^.cl4_count-currpd^.cl4_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl3 parameters? }
|
||||
res:=(bestpd^.cl3_count-currpd^.cl3_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl2 parameters? }
|
||||
res:=(bestpd^.cl2_count-currpd^.cl2_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl1 parameters? }
|
||||
res:=(bestpd^.cl1_count-currpd^.cl1_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ more exact parameters? }
|
||||
res:=(currpd^.exact_count-bestpd^.exact_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less equal parameters? }
|
||||
res:=(bestpd^.equal_count-currpd^.equal_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ smaller ordinal distance? }
|
||||
if (currpd^.ordinal_distance<bestpd^.ordinal_distance) then
|
||||
res:=1
|
||||
else
|
||||
if (currpd^.ordinal_distance>bestpd^.ordinal_distance) then
|
||||
res:=-1
|
||||
else
|
||||
res:=0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ less cl5 parameters? }
|
||||
res:=(bestpd^.cl5_count-currpd^.cl5_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl4 parameters? }
|
||||
res:=(bestpd^.cl4_count-currpd^.cl4_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl3 parameters? }
|
||||
res:=(bestpd^.cl3_count-currpd^.cl3_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl2 parameters? }
|
||||
res:=(bestpd^.cl2_count-currpd^.cl2_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less cl1 parameters? }
|
||||
res:=(bestpd^.cl1_count-currpd^.cl1_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ more exact parameters? }
|
||||
res:=(currpd^.exact_count-bestpd^.exact_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ less equal parameters? }
|
||||
res:=(bestpd^.equal_count-currpd^.equal_count);
|
||||
if (res=0) then
|
||||
begin
|
||||
{ smaller ordinal distance? }
|
||||
if (currpd^.ordinal_distance<bestpd^.ordinal_distance) then
|
||||
res:=1
|
||||
else
|
||||
if (currpd^.ordinal_distance>bestpd^.ordinal_distance) then
|
||||
res:=-1
|
||||
else
|
||||
res:=0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -1715,7 +1715,8 @@ implementation
|
||||
te_convert_l1,
|
||||
te_convert_l2,
|
||||
te_convert_l3,
|
||||
te_convert_l4:
|
||||
te_convert_l4,
|
||||
te_convert_l5:
|
||||
begin
|
||||
result := simplify;
|
||||
if assigned(result) then
|
||||
|
@ -433,6 +433,7 @@ type
|
||||
tequaltype = (
|
||||
te_incompatible,
|
||||
te_convert_operator,
|
||||
te_convert_l5, { ad infinitum... }
|
||||
te_convert_l4, { and yet even less preferred conversion }
|
||||
te_convert_l3, { even less preferred conversion (possibly with loss of data) }
|
||||
te_convert_l2, { compatible less preferred conversion }
|
||||
@ -493,7 +494,7 @@ const
|
||||
);
|
||||
|
||||
EqualTypeName : array[tequaltype] of string[16] = (
|
||||
'incompatible','convert_operator','convert_l4','convert_l3','convert_l2',
|
||||
'incompatible','convert_operator','convert_l5','convert_l4','convert_l3','convert_l2',
|
||||
'convert_l1','equal','exact'
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user