mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-27 12:17:25 +01:00
* fix and simplify twhilerepeatnode.internalsimplify
This commit is contained in:
parent
5f5fb3febb
commit
7b2b51e6f3
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user