* fix and simplify twhilerepeatnode.internalsimplify

This commit is contained in:
florian 2025-08-18 22:56:19 +02:00
parent 5f5fb3febb
commit 7b2b51e6f3
2 changed files with 15 additions and 7 deletions

View File

@ -1363,9 +1363,9 @@ implementation
(tordconstnode(taddnode(left).right).value=0)) then
begin
p:=GetLastStatement(right);
if assigned(p) and (tstatementnode(p).left.nodetype=inlinen) and (tinlinenode(tstatementnode(p).left).inlinenumber=in_dec_x) and
taddnode(left).left.isequal(tcallparanode(tinlinenode(tstatementnode(p).left).left).left) and
not(assigned(tcallparanode(tinlinenode(tstatementnode(p).left).left).right)) then
if assigned(p) and (p.nodetype=inlinen) and (tinlinenode(p).inlinenumber=in_dec_x) and
taddnode(left).left.isequal(tcallparanode(tinlinenode(p).left).left) and
not(assigned(tcallparanode(tinlinenode(p).left).right)) then
begin
result:=cifnode.create_internal(left.getcopy,getcopy,nil);
include(twhilerepeatnode(tifnode(result).right).loopflags,lnf_checknegate);

View File

@ -1674,12 +1674,20 @@ implementation
Result:=p;
while assigned(Result) do
begin
if (Result.nodetype=statementn) and assigned(tstatementnode(Result).next) then
Result:=tstatementnode(Result).next
if Result.nodetype=statementn then
begin
if assigned(tstatementnode(Result).next) then
Result:=tstatementnode(Result).next
else if tstatementnode(Result).statement.nodetype=blockn then
Result:=tblocknode(tstatementnode(Result).left).statements
else
begin
Result:=tstatementnode(Result).statement;
exit;
end;
end
else if Result.nodetype=blockn then
Result:=tblocknode(Result).statements
else if (Result.nodetype=statementn) and (tstatementnode(Result).statement.nodetype=blockn) then
Result:=tblocknode(tstatementnode(Result).left).statements
else
exit;
end;