mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-21 06:29:33 +02:00
* fixed crash when trying to index a record without a default property
git-svn-id: trunk@17480 -
This commit is contained in:
parent
62ac6c23a0
commit
b0e83a06af
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8390,6 +8390,7 @@ tests/tbf/tb0217.pp svneol=native#text/plain
|
|||||||
tests/tbf/tb0218.pp svneol=native#text/plain
|
tests/tbf/tb0218.pp svneol=native#text/plain
|
||||||
tests/tbf/tb0219.pp svneol=native#text/pascal
|
tests/tbf/tb0219.pp svneol=native#text/pascal
|
||||||
tests/tbf/tb0220.pp svneol=native#text/plain
|
tests/tbf/tb0220.pp svneol=native#text/plain
|
||||||
|
tests/tbf/tb0221.pp svneol=native#text/plain
|
||||||
tests/tbf/ub0115.pp svneol=native#text/plain
|
tests/tbf/ub0115.pp svneol=native#text/plain
|
||||||
tests/tbf/ub0149.pp svneol=native#text/plain
|
tests/tbf/ub0149.pp svneol=native#text/plain
|
||||||
tests/tbf/ub0158a.pp svneol=native#text/plain
|
tests/tbf/ub0158a.pp svneol=native#text/plain
|
||||||
|
@ -1930,7 +1930,7 @@ implementation
|
|||||||
is_dispinterface(p1.resultdef) or is_record(p1.resultdef) then
|
is_dispinterface(p1.resultdef) or is_record(p1.resultdef) then
|
||||||
begin
|
begin
|
||||||
{ default property }
|
{ default property }
|
||||||
protsym:=search_default_property(tobjectdef(p1.resultdef));
|
protsym:=search_default_property(tabstractrecorddef(p1.resultdef));
|
||||||
if not(assigned(protsym)) then
|
if not(assigned(protsym)) then
|
||||||
begin
|
begin
|
||||||
p1.destroy;
|
p1.destroy;
|
||||||
|
@ -247,7 +247,7 @@ interface
|
|||||||
function defined_macro(const s : string):boolean;
|
function defined_macro(const s : string):boolean;
|
||||||
|
|
||||||
{*** Object Helpers ***}
|
{*** Object Helpers ***}
|
||||||
function search_default_property(pd : tobjectdef) : tpropertysym;
|
function search_default_property(pd : tabstractrecorddef) : tpropertysym;
|
||||||
function find_real_objcclass_definition(pd: tobjectdef; erroronfailure: boolean): tobjectdef;
|
function find_real_objcclass_definition(pd: tobjectdef; erroronfailure: boolean): tobjectdef;
|
||||||
|
|
||||||
{*** Macro Helpers ***}
|
{*** Macro Helpers ***}
|
||||||
@ -2854,7 +2854,7 @@ implementation
|
|||||||
Object Helpers
|
Object Helpers
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
function search_default_property(pd : tobjectdef) : tpropertysym;
|
function search_default_property(pd : tabstractrecorddef) : tpropertysym;
|
||||||
{ returns the default property of a class, searches also anchestors }
|
{ returns the default property of a class, searches also anchestors }
|
||||||
var
|
var
|
||||||
_defaultprop : tpropertysym;
|
_defaultprop : tpropertysym;
|
||||||
@ -2881,7 +2881,10 @@ implementation
|
|||||||
pd.symtable.SymList.ForEachCall(@tstoredsymtable(pd.symtable).testfordefaultproperty,@_defaultprop);
|
pd.symtable.SymList.ForEachCall(@tstoredsymtable(pd.symtable).testfordefaultproperty,@_defaultprop);
|
||||||
if assigned(_defaultprop) then
|
if assigned(_defaultprop) then
|
||||||
break;
|
break;
|
||||||
pd:=pd.childof;
|
if (pd.typ=objectdef) then
|
||||||
|
pd:=tobjectdef(pd).childof
|
||||||
|
else
|
||||||
|
break;
|
||||||
end;
|
end;
|
||||||
search_default_property:=_defaultprop;
|
search_default_property:=_defaultprop;
|
||||||
end;
|
end;
|
||||||
|
14
tests/tbf/tb0221.pp
Normal file
14
tests/tbf/tb0221.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ %fail }
|
||||||
|
|
||||||
|
{ should not crash the compiler }
|
||||||
|
|
||||||
|
type
|
||||||
|
tr = record
|
||||||
|
a,b: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
r: tr;
|
||||||
|
begin
|
||||||
|
r[0].a:=1;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user