mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:59:11 +02:00
* Renamed fc_block_with_exit to fc_no_direct_exit to expand its usage.
* Set fc_no_direct_exit in case when a routine has an additional implicit exit code, such as calling FreeInstance in the destructor. git-svn-id: trunk@47749 -
This commit is contained in:
parent
6eb37beb24
commit
8b7c5666a2
@ -443,7 +443,7 @@ interface
|
|||||||
oldflowcontrol:=flowcontrol;
|
oldflowcontrol:=flowcontrol;
|
||||||
{ the nested block will not span an exit statement of the parent }
|
{ the nested block will not span an exit statement of the parent }
|
||||||
exclude(flowcontrol,fc_exit);
|
exclude(flowcontrol,fc_exit);
|
||||||
include(flowcontrol,fc_block_with_exit);
|
include(flowcontrol,fc_no_direct_exit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ do second pass on left node }
|
{ do second pass on left node }
|
||||||
@ -469,7 +469,7 @@ interface
|
|||||||
current_procinfo.CurrExitLabel:=oldexitlabel;
|
current_procinfo.CurrExitLabel:=oldexitlabel;
|
||||||
{ the exit statements inside this block are not exit statements }
|
{ the exit statements inside this block are not exit statements }
|
||||||
{ out of the parent }
|
{ out of the parent }
|
||||||
flowcontrol:=oldflowcontrol+(flowcontrol - [fc_exit,fc_block_with_exit]);
|
flowcontrol:=oldflowcontrol+(flowcontrol - [fc_exit,fc_no_direct_exit]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
location_reset(location,LOC_VOID,OS_NO);
|
location_reset(location,LOC_VOID,OS_NO);
|
||||||
|
|
||||||
if fc_block_with_exit in flowcontrol then
|
if fc_no_direct_exit in flowcontrol then
|
||||||
include(flowcontrol,fc_gotolabel);
|
include(flowcontrol,fc_gotolabel);
|
||||||
include(flowcontrol,fc_exit);
|
include(flowcontrol,fc_exit);
|
||||||
if assigned(left) then
|
if assigned(left) then
|
||||||
|
@ -44,8 +44,9 @@ uses
|
|||||||
{ the left side of an expression is already handled, so we are
|
{ the left side of an expression is already handled, so we are
|
||||||
not allowed to do ssl }
|
not allowed to do ssl }
|
||||||
fc_lefthandled,
|
fc_lefthandled,
|
||||||
{ in block which contains the exit statement }
|
{ in block where the exit statement jumps to an extra code instead of
|
||||||
fc_block_with_exit);
|
immediately finishing execution of the current routine. }
|
||||||
|
fc_no_direct_exit);
|
||||||
|
|
||||||
tflowcontrol = set of tenumflowcontrol;
|
tflowcontrol = set of tenumflowcontrol;
|
||||||
|
|
||||||
|
@ -927,6 +927,11 @@ implementation
|
|||||||
exitlabel_asmnode:=casmnode.create_get_position;
|
exitlabel_asmnode:=casmnode.create_get_position;
|
||||||
temps_finalized:=false;
|
temps_finalized:=false;
|
||||||
bodyexitcode:=generate_bodyexit_block;
|
bodyexitcode:=generate_bodyexit_block;
|
||||||
|
{ Check if bodyexitcode is not empty }
|
||||||
|
with tstatementnode(tblocknode(bodyexitcode).statements) do
|
||||||
|
if (statement.nodetype<>nothingn) or assigned(next) then
|
||||||
|
{ Indicate that the extra code is executed after the exit statement }
|
||||||
|
include(flowcontrol,fc_no_direct_exit);
|
||||||
|
|
||||||
{ Generate procedure by combining init+body+final,
|
{ Generate procedure by combining init+body+final,
|
||||||
depending on the implicit finally we need to add
|
depending on the implicit finally we need to add
|
||||||
|
Loading…
Reference in New Issue
Block a user