* Node-stripping optimisation in "TBlockNode.simplify" now uses "has_child_of_type" to determine stop point

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2024-05-09 21:11:15 +01:00 committed by FPK
parent a91c1ab627
commit 59ff8a0f65

View File

@ -763,6 +763,9 @@ implementation
function tblocknode.simplify(forinline : boolean): tnode;
const
NodeStripTerminators = [labeln, asmn, tempcreaten, tempdeleten];
var
n, p, first, last: tstatementnode;
{$ifdef break_inlining}
@ -819,7 +822,7 @@ implementation
p := TStatementNode(n.Next);
while Assigned(p) do
begin
if (TStatementNode(p).left.nodetype in [labeln, asmn, tempcreaten, tempdeleten, blockn]) then
if has_node_of_type(TStatementNode(p).left, NodeStripTerminators) then
Break;
last := p;