mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 18:10:26 +02:00
* allow goto inside finally blocks
git-svn-id: trunk@11392 -
This commit is contained in:
parent
4dc547e01c
commit
050627ea1d
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -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
|
||||
|
@ -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
18
tests/tbf/tb0209.pp
Normal 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
17
tests/tbs/tb0553.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user