mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 21:50:18 +02:00
* fix finally block getting unconditionally removed if try-block is empty
(hasnocode(nil) always returns true). Regression from r48174 git-svn-id: trunk@49305 -
This commit is contained in:
parent
5cde6facdb
commit
9977889f4a
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18839,6 +18839,7 @@ tests/webtbs/tw38718.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw38733.pp svneol=native#text/pascal
|
tests/webtbs/tw38733.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38766.pp svneol=native#text/plain
|
tests/webtbs/tw38766.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw38802.pp svneol=native#text/pascal
|
tests/webtbs/tw38802.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw38833.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3893.pp svneol=native#text/plain
|
tests/webtbs/tw3893.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3898.pp svneol=native#text/plain
|
tests/webtbs/tw3898.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3899.pp svneol=native#text/plain
|
tests/webtbs/tw3899.pp svneol=native#text/plain
|
||||||
|
@ -2734,10 +2734,10 @@ implementation
|
|||||||
begin
|
begin
|
||||||
result:=right;
|
result:=right;
|
||||||
right:=nil;
|
right:=nil;
|
||||||
end;
|
end
|
||||||
{ if the finally block contains no code, we can kill
|
{ if the finally block contains no code, we can kill
|
||||||
it and just return the try part }
|
it and just return the try part }
|
||||||
if has_no_code(right) and not(assigned(third)) and not(implicitframe) then
|
else if has_no_code(right) and not(assigned(third)) and not(implicitframe) then
|
||||||
begin
|
begin
|
||||||
result:=left;
|
result:=left;
|
||||||
left:=nil;
|
left:=nil;
|
||||||
|
18
tests/webtbs/tw38833.pp
Normal file
18
tests/webtbs/tw38833.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
program EmptyTryFinally1;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
{$apptype console}
|
||||||
|
|
||||||
|
var
|
||||||
|
finallyrun: boolean;
|
||||||
|
begin
|
||||||
|
finallyrun:=false;
|
||||||
|
try
|
||||||
|
// Empty try statement block
|
||||||
|
finally
|
||||||
|
WriteLn('I should actually visible . . .'); // but I'm not
|
||||||
|
finallyrun:=true;
|
||||||
|
end;
|
||||||
|
if not finallyrun then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user