mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 19:50:54 +02:00
* match the label to the wider block, if it is adjacent to both the brevious
and the next instruction
This commit is contained in:
parent
c96e203780
commit
4e3a6aa5a8
@ -440,23 +440,16 @@ implementation
|
|||||||
begin
|
begin
|
||||||
lbl:=tai_label(hp);
|
lbl:=tai_label(hp);
|
||||||
lbl.labsym.nestingdepth:=-1;
|
lbl.labsym.nestingdepth:=-1;
|
||||||
{ first, try to match label to the previous instruction }
|
|
||||||
if assigned(lastinstr) then
|
|
||||||
begin
|
|
||||||
if lastinstr.opcode=a_loop then
|
|
||||||
lbl.labsym.nestingdepth:=cur_nesting_depth
|
|
||||||
else if lastinstr.opcode in [a_end_block,a_end_try,a_end_if] then
|
|
||||||
lbl.labsym.nestingdepth:=cur_nesting_depth+1;
|
|
||||||
end;
|
|
||||||
{ if not matched, try to match it to the next instruction }
|
|
||||||
if lbl.labsym.nestingdepth=-1 then
|
|
||||||
begin
|
|
||||||
nextinstr:=FindNextInstruction(hp);
|
nextinstr:=FindNextInstruction(hp);
|
||||||
if nextinstr.opcode=a_loop then
|
|
||||||
|
if assigned(nextinstr) and (nextinstr.opcode in [a_end_block,a_end_try,a_end_if]) then
|
||||||
|
lbl.labsym.nestingdepth:=cur_nesting_depth
|
||||||
|
else if assigned(lastinstr) and (lastinstr.opcode=a_loop) then
|
||||||
|
lbl.labsym.nestingdepth:=cur_nesting_depth
|
||||||
|
else if assigned(lastinstr) and (lastinstr.opcode in [a_end_block,a_end_try,a_end_if]) then
|
||||||
lbl.labsym.nestingdepth:=cur_nesting_depth+1
|
lbl.labsym.nestingdepth:=cur_nesting_depth+1
|
||||||
else if nextinstr.opcode in [a_end_block,a_end_try,a_end_if] then
|
else if assigned(nextinstr) and (nextinstr.opcode=a_loop) then
|
||||||
lbl.labsym.nestingdepth:=cur_nesting_depth;
|
lbl.labsym.nestingdepth:=cur_nesting_depth+1;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user