mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 06:08:16 +02:00
* fixed support for repeating constructor without parameters in Delphi
mode + test git-svn-id: trunk@5692 -
This commit is contained in:
parent
984191ef0e
commit
a63ed25f74
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6239,6 +6239,7 @@ tests/tbs/tb0514.pp svneol=native#text/plain
|
||||
tests/tbs/tb0515.pp svneol=native#text/plain
|
||||
tests/tbs/tb0516.pp svneol=native#text/plain
|
||||
tests/tbs/tb0517.pp svneol=native#text/plain
|
||||
tests/tbs/tb0518.pp svneol=native#text/plain
|
||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||
tests/tbs/ub0069.pp svneol=native#text/plain
|
||||
tests/tbs/ub0119.pp svneol=native#text/plain
|
||||
|
@ -230,6 +230,9 @@ interface
|
||||
{# returns true, if the type passed is a varset }
|
||||
function is_varset(p : tdef) : boolean;
|
||||
|
||||
{ # returns true if the procdef has no parameters and no specified return type }
|
||||
function is_bareprocdef(pd : tprocdef): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -1018,4 +1021,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function is_bareprocdef(pd : tprocdef): boolean;
|
||||
begin
|
||||
result:=(pd.maxparacount=0) and
|
||||
(is_void(pd.returndef) or
|
||||
(pd.proctypeoption = potype_constructor));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -2431,7 +2431,7 @@ const
|
||||
(
|
||||
not(m_repeat_forward in current_settings.modeswitches) and
|
||||
not(currpd.forwarddef) and
|
||||
(currpd.maxparacount=0) and
|
||||
is_bareprocdef(currpd) and
|
||||
not(po_overload in fwpd.procoptions)
|
||||
) or
|
||||
{ check arguments, we need to check only the user visible parameters. The hidden parameters
|
||||
@ -2455,12 +2455,12 @@ const
|
||||
begin
|
||||
forwardfound:=true;
|
||||
|
||||
if (m_repeat_forward in current_settings.modeswitches) or
|
||||
if not(m_repeat_forward in current_settings.modeswitches) and
|
||||
(fwpd.proccalloption<>currpd.proccalloption) then
|
||||
paracompopt:=[cpo_ignorehidden,cpo_comparedefaultvalue]
|
||||
else
|
||||
paracompopt:=[cpo_comparedefaultvalue];
|
||||
|
||||
|
||||
{ Check calling convention }
|
||||
if (fwpd.proccalloption<>currpd.proccalloption) then
|
||||
begin
|
||||
@ -2495,8 +2495,7 @@ const
|
||||
{ Check if the procedure type and return type are correct,
|
||||
also the parameters must match also with the type }
|
||||
if ((m_repeat_forward in current_settings.modeswitches) or
|
||||
(currpd.maxparacount<>0) or
|
||||
(not(is_void(currpd.returndef)))) and
|
||||
not is_bareprocdef(currpd)) and
|
||||
((compare_paras(currpd.paras,fwpd.paras,cp_all,paracompopt)<te_equal) or
|
||||
(not equal_defs(fwpd.returndef,currpd.returndef))) then
|
||||
begin
|
||||
|
14
tests/tbs/tb0518.pp
Normal file
14
tests/tbs/tb0518.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{$mode delphi}
|
||||
type
|
||||
tc = class
|
||||
constructor create(const n: ansistring);
|
||||
end;
|
||||
|
||||
constructor tc.create;
|
||||
begin
|
||||
if (n <> 'abc') then halt(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
tc.create('abc');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user