* property index is always a s32int

* property implementations must match parameters equal

git-svn-id: trunk@1995 -
This commit is contained in:
peter 2005-12-20 07:58:38 +00:00
parent f618792e01
commit dfd9b6e862
4 changed files with 65 additions and 8 deletions

2
.gitattributes vendored
View File

@ -5912,6 +5912,8 @@ tests/webtbf/tw4445.pp svneol=native#text/plain
tests/webtbf/tw4529.pp svneol=native#text/plain
tests/webtbf/tw4569a.pp svneol=native#text/plain
tests/webtbf/tw4569b.pp svneol=native#text/plain
tests/webtbf/tw4619a.pp -text svneol=unset#text/plain
tests/webtbf/tw4619b.pp svneol=native#text/plain
tests/webtbf/uw0744.pp svneol=native#text/plain
tests/webtbf/uw0840a.pp svneol=native#text/plain
tests/webtbf/uw0840b.pp svneol=native#text/plain

View File

@ -345,19 +345,23 @@ implementation
begin
consume(_INDEX);
pt:=comp_expr(true);
{ Only allow enum and integer indexes. Convert all integer
values to s32int to be compatible with delphi, because the
procedure matching requires equal parameters }
if is_constnode(pt) and
is_ordinal(pt.resulttype.def)
{$ifndef cpu64bit}
and (not is_64bitint(pt.resulttype.def))
{$endif}
then
p.index:=tordconstnode(pt).value
and (not is_64bitint(pt.resulttype.def)) then
begin
if is_integer(pt.resulttype.def) then
inserttypeconv_internal(pt,s32inttype);
p.index:=tordconstnode(pt).value;
end
else
begin
Message(parser_e_invalid_property_index_value);
p.index:=0;
end;
p.indextype.setdef(pt.resulttype.def);
p.indextype:=pt.resulttype;
include(p.propoptions,ppo_indexed);
{ concat a longint to the para templates }
inc(paranr);
@ -403,7 +407,7 @@ implementation
{ we ignore hidden stuff here because the property access symbol might have
non default calling conventions which might change the hidden stuff;
see tw3216.pp (FK) }
p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.paras,p.proptype.def,[cpo_allowdefaults,cpo_ignorehidden,cpo_allowconvert]);
p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.paras,p.proptype.def,[cpo_allowdefaults,cpo_ignorehidden]);
if not assigned(p.readaccess.procdef) then
Message(parser_e_ill_property_access_sym);
end;
@ -447,7 +451,7 @@ implementation
{ Insert hidden parameters }
handle_calling_convention(writeprocdef);
{ search procdefs matching writeprocdef }
p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.paras,writeprocdef.rettype.def,[cpo_allowdefaults,cpo_allowconvert]);
p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.paras,writeprocdef.rettype.def,[cpo_allowdefaults]);
if not assigned(p.writeaccess.procdef) then
Message(parser_e_ill_property_access_sym);
end;

26
tests/webtbf/tw4619a.pp Executable file
View File

@ -0,0 +1,26 @@
{ %fail }
{ Source provided for Free Pascal Bug Report 4619 }
{ Submitted by "Christian Iversen" on 2005-12-19 }
{ e-mail: chrivers@iversen-net.dk }
{$mode delphi}
type
TStatement = class
end;
TBlock = class(TStatement)
protected
// The parameter must be Integer instead of LongWord
function GetStat(const Index: LongWord): TStatement;
public
property Statement1: TStatement index 1 read GetStat;
end;
function TBlock.GetStat(const Index: LongWord): TStatement;
begin
end;
begin
end.

25
tests/webtbf/tw4619b.pp Executable file
View File

@ -0,0 +1,25 @@
{ %fail }
{ Source provided for Free Pascal Bug Report 4619 }
{ Submitted by "Christian Iversen" on 2005-12-19 }
{ e-mail: chrivers@iversen-net.dk }
{$mode delphi}
type
TStatement = class
end;
TBlock = class(TStatement)
protected
function GetStat(const Index: LongWord): TStatement;
public
property Statement[const Index: Integer]: TStatement read GetStat; default;
end;
function TBlock.GetStat(const Index: LongWord): TStatement;
begin
end;
begin
end.