mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 04:29:29 +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;
|
||||
{ the nested block will not span an exit statement of the parent }
|
||||
exclude(flowcontrol,fc_exit);
|
||||
include(flowcontrol,fc_block_with_exit);
|
||||
include(flowcontrol,fc_no_direct_exit);
|
||||
end;
|
||||
|
||||
{ do second pass on left node }
|
||||
@ -469,7 +469,7 @@ interface
|
||||
current_procinfo.CurrExitLabel:=oldexitlabel;
|
||||
{ the exit statements inside this block are not exit statements }
|
||||
{ out of the parent }
|
||||
flowcontrol:=oldflowcontrol+(flowcontrol - [fc_exit,fc_block_with_exit]);
|
||||
flowcontrol:=oldflowcontrol+(flowcontrol - [fc_exit,fc_no_direct_exit]);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -404,7 +404,7 @@ implementation
|
||||
begin
|
||||
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_exit);
|
||||
if assigned(left) then
|
||||
|
@ -44,8 +44,9 @@ uses
|
||||
{ the left side of an expression is already handled, so we are
|
||||
not allowed to do ssl }
|
||||
fc_lefthandled,
|
||||
{ in block which contains the exit statement }
|
||||
fc_block_with_exit);
|
||||
{ in block where the exit statement jumps to an extra code instead of
|
||||
immediately finishing execution of the current routine. }
|
||||
fc_no_direct_exit);
|
||||
|
||||
tflowcontrol = set of tenumflowcontrol;
|
||||
|
||||
|
@ -927,6 +927,11 @@ implementation
|
||||
exitlabel_asmnode:=casmnode.create_get_position;
|
||||
temps_finalized:=false;
|
||||
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,
|
||||
depending on the implicit finally we need to add
|
||||
|
Loading…
Reference in New Issue
Block a user