* don't crash when parsing exit(xxx) in a constructor (mantis #23110)

git-svn-id: trunk@22795 -
This commit is contained in:
Jonas Maebe 2012-10-21 13:43:03 +00:00
parent 6497d3c994
commit 1822c46d8a
3 changed files with 15 additions and 2 deletions

1
.gitattributes vendored
View File

@ -12930,6 +12930,7 @@ tests/webtbs/tw2305.pp svneol=native#text/plain
tests/webtbs/tw2306.pp svneol=native#text/plain tests/webtbs/tw2306.pp svneol=native#text/plain
tests/webtbs/tw2307.pp svneol=native#text/plain tests/webtbs/tw2307.pp svneol=native#text/plain
tests/webtbs/tw2311.pp svneol=native#text/plain tests/webtbs/tw2311.pp svneol=native#text/plain
tests/webtbs/tw23110.pp svneol=native#text/plain
tests/webtbs/tw2317.pp svneol=native#text/plain tests/webtbs/tw2317.pp svneol=native#text/plain
tests/webtbs/tw2318.pp svneol=native#text/plain tests/webtbs/tw2318.pp svneol=native#text/plain
tests/webtbs/tw2318b.pp svneol=native#text/plain tests/webtbs/tw2318b.pp svneol=native#text/plain

View File

@ -306,8 +306,9 @@ implementation
begin begin
p1:=comp_expr(true,false); p1:=comp_expr(true,false);
consume(_RKLAMMER); consume(_RKLAMMER);
if (not assigned(current_procinfo) or if not assigned(current_procinfo) or
is_void(current_procinfo.procdef.returndef)) then (current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) or
is_void(current_procinfo.procdef.returndef) then
begin begin
Message(parser_e_void_function); Message(parser_e_void_function);
{ recovery } { recovery }

11
tests/webtbs/tw23110.pp Normal file
View File

@ -0,0 +1,11 @@
type TTest = object
constructor Init;
end;
constructor TTest.Init;
begin
exit (0);
end;
begin
end.