* leave parse_proc_head() (with some error recovery) if the interface could not be found instead of running straight into an access violation

+ added test

git-svn-id: trunk@35007 -
This commit is contained in:
svenbarth 2016-11-28 17:54:48 +00:00
parent a4e9a6d6e4
commit 3f77ce3b12
3 changed files with 23 additions and 1 deletions

1
.gitattributes vendored
View File

@ -10419,6 +10419,7 @@ tests/tbf/tb0251.pp svneol=native#text/pascal
tests/tbf/tb0252a.pp svneol=native#text/plain tests/tbf/tb0252a.pp svneol=native#text/plain
tests/tbf/tb0252b.pp svneol=native#text/plain tests/tbf/tb0252b.pp svneol=native#text/plain
tests/tbf/tb0252c.pp svneol=native#text/plain tests/tbf/tb0252c.pp svneol=native#text/plain
tests/tbf/tb0253.pp svneol=native#text/pascal
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

View File

@ -878,7 +878,14 @@ implementation
(ttypesym(srsym).typedef.typ=objectdef) then (ttypesym(srsym).typedef.typ=objectdef) then
ImplIntf:=find_implemented_interface(tobjectdef(astruct),tobjectdef(ttypesym(srsym).typedef)); ImplIntf:=find_implemented_interface(tobjectdef(astruct),tobjectdef(ttypesym(srsym).typedef));
if ImplIntf=nil then if ImplIntf=nil then
Message(parser_e_interface_id_expected) begin
Message(parser_e_interface_id_expected);
{ error recovery }
consume(_ID);
if try_to_consume(_EQ) then
consume(_ID);
exit;
end
else else
{ in case of a generic or specialized interface we need to use the { in case of a generic or specialized interface we need to use the
name of the def instead of the symbol, so that always the correct name of the def instead of the symbol, so that always the correct

14
tests/tbf/tb0253.pp Normal file
View File

@ -0,0 +1,14 @@
{ %FAIL }
program tb0253;
{$mode objfpc}
type
TTest = class(TObject, IInterface)
procedure Blubb.Bar = Foo;
end;
begin
end.