mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 10:29:08 +02:00
* property index is always a s32int
* property implementations must match parameters equal git-svn-id: trunk@1995 -
This commit is contained in:
parent
f618792e01
commit
dfd9b6e862
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -5912,6 +5912,8 @@ tests/webtbf/tw4445.pp svneol=native#text/plain
|
|||||||
tests/webtbf/tw4529.pp svneol=native#text/plain
|
tests/webtbf/tw4529.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw4569a.pp svneol=native#text/plain
|
tests/webtbf/tw4569a.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw4569b.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/uw0744.pp svneol=native#text/plain
|
||||||
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
||||||
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
||||||
|
@ -345,19 +345,23 @@ implementation
|
|||||||
begin
|
begin
|
||||||
consume(_INDEX);
|
consume(_INDEX);
|
||||||
pt:=comp_expr(true);
|
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
|
if is_constnode(pt) and
|
||||||
is_ordinal(pt.resulttype.def)
|
is_ordinal(pt.resulttype.def)
|
||||||
{$ifndef cpu64bit}
|
and (not is_64bitint(pt.resulttype.def)) then
|
||||||
and (not is_64bitint(pt.resulttype.def))
|
begin
|
||||||
{$endif}
|
if is_integer(pt.resulttype.def) then
|
||||||
then
|
inserttypeconv_internal(pt,s32inttype);
|
||||||
p.index:=tordconstnode(pt).value
|
p.index:=tordconstnode(pt).value;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Message(parser_e_invalid_property_index_value);
|
Message(parser_e_invalid_property_index_value);
|
||||||
p.index:=0;
|
p.index:=0;
|
||||||
end;
|
end;
|
||||||
p.indextype.setdef(pt.resulttype.def);
|
p.indextype:=pt.resulttype;
|
||||||
include(p.propoptions,ppo_indexed);
|
include(p.propoptions,ppo_indexed);
|
||||||
{ concat a longint to the para templates }
|
{ concat a longint to the para templates }
|
||||||
inc(paranr);
|
inc(paranr);
|
||||||
@ -403,7 +407,7 @@ implementation
|
|||||||
{ we ignore hidden stuff here because the property access symbol might have
|
{ we ignore hidden stuff here because the property access symbol might have
|
||||||
non default calling conventions which might change the hidden stuff;
|
non default calling conventions which might change the hidden stuff;
|
||||||
see tw3216.pp (FK) }
|
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
|
if not assigned(p.readaccess.procdef) then
|
||||||
Message(parser_e_ill_property_access_sym);
|
Message(parser_e_ill_property_access_sym);
|
||||||
end;
|
end;
|
||||||
@ -447,7 +451,7 @@ implementation
|
|||||||
{ Insert hidden parameters }
|
{ Insert hidden parameters }
|
||||||
handle_calling_convention(writeprocdef);
|
handle_calling_convention(writeprocdef);
|
||||||
{ search procdefs matching 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
|
if not assigned(p.writeaccess.procdef) then
|
||||||
Message(parser_e_ill_property_access_sym);
|
Message(parser_e_ill_property_access_sym);
|
||||||
end;
|
end;
|
||||||
|
26
tests/webtbf/tw4619a.pp
Executable file
26
tests/webtbf/tw4619a.pp
Executable 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
25
tests/webtbf/tw4619b.pp
Executable 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.
|
Loading…
Reference in New Issue
Block a user