* allow exit(value) in exception blocks. Forbidding this dates back to

when this construct was still handled by custom code (mantis #16803)

git-svn-id: trunk@15492 -
This commit is contained in:
Jonas Maebe 2010-06-29 16:56:59 +00:00
parent 5dd72acf36
commit 60041ebf8b
3 changed files with 47 additions and 8 deletions

1
.gitattributes vendored
View File

@ -10521,6 +10521,7 @@ tests/webtbs/tw16757.pp svneol=native#text/plain
tests/webtbs/tw1677.pp svneol=native#text/plain
tests/webtbs/tw16770.pp svneol=native#text/plain
tests/webtbs/tw16772.pp svneol=native#text/plain
tests/webtbs/tw16803.pp svneol=native#text/plain
tests/webtbs/tw1681.pp svneol=native#text/plain
tests/webtbs/tw1696.pp svneol=native#text/plain
tests/webtbs/tw1699.pp svneol=native#text/plain

View File

@ -298,14 +298,7 @@ implementation
begin
p1:=comp_expr(true);
consume(_RKLAMMER);
if (block_type=bt_except) then
begin
Message(parser_e_exit_with_argument_not__possible);
{ recovery }
p1.free;
p1:=nil;
end
else if (not assigned(current_procinfo) or
if (not assigned(current_procinfo) or
is_void(current_procinfo.procdef.returndef)) then
begin
Message(parser_e_void_function);

45
tests/webtbs/tw16803.pp Normal file
View File

@ -0,0 +1,45 @@
{ %opt=-g-h }
{$ifdef fpc}
{$mode delphi}
{$endif}
uses
sysutils;
function test1: longint;
begin
try
try
result:=1;
raise exception.create('1');
except
exit(2);
end;
except
exit(3);
end;
end;
function test2: ansistring;
begin
result:='a';
try
try
result:=result+'b';
raise exception.create('2');
except
result:=result+'c';
end;
except
result:=result+'d';
end;
end;
begin
HaltOnNotReleased:=true;
if test1<>2 then
halt(1);
if test2<>'abc' then
halt(2)
end.