* allow goto inside finally blocks

git-svn-id: trunk@11392 -
This commit is contained in:
florian 2008-07-17 19:49:38 +00:00
parent 4dc547e01c
commit 050627ea1d
4 changed files with 40 additions and 1 deletions

2
.gitattributes vendored
View File

@ -6437,6 +6437,7 @@ tests/tbf/tb0205.pp svneol=native#text/plain
tests/tbf/tb0206.pp svneol=native#text/plain
tests/tbf/tb0207.pp svneol=native#text/plain
tests/tbf/tb0208.pp svneol=native#text/plain
tests/tbf/tb0209.pp svneol=native#text/plain
tests/tbf/ub0115.pp svneol=native#text/plain
tests/tbf/ub0149.pp svneol=native#text/plain
tests/tbf/ub0158a.pp svneol=native#text/plain
@ -6986,6 +6987,7 @@ tests/tbs/tb0550a.pp svneol=native#text/plain
tests/tbs/tb0550b.pp svneol=native#text/plain
tests/tbs/tb0551.pp svneol=native#text/plain
tests/tbs/tb0552.pp svneol=native#text/plain
tests/tbs/tb0553.pp svneol=native#text/plain
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain

View File

@ -1501,7 +1501,9 @@ implementation
{ finally code }
flowcontrol:=[fc_inflowcontrol];
secondpass(right);
if flowcontrol<>[fc_inflowcontrol] then
{ goto is allowed if it stays inside the finally block,
this is checked using the exception block number }
if (flowcontrol-[fc_gotolabel])<>[fc_inflowcontrol] then
CGMessage(cg_e_control_flow_outside_finally);
if codegenerror then
exit;

18
tests/tbf/tb0209.pp Normal file
View File

@ -0,0 +1,18 @@
{ %fail }
{$mode objfpc}
{$goto on}
var
a : longint;
label
g;
begin
try
a:=2;
finally
if a>1 then
goto g;
writeln('Error');
end;
g:
end.

17
tests/tbs/tb0553.pp Normal file
View File

@ -0,0 +1,17 @@
{$mode objfpc}
{$goto on}
var
a : longint;
label
g;
begin
try
a:=2;
finally
if a>1 then
goto g;
writeln('Error');
g:
end;
end.