Forum > FPC development

[SOLVED] Simplified function TPasRecordType.IsAdvancedRecord: Boolean;

(1/1)

lagprogramming:
packages/fcl-passrc/src/pastree.pp has

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function TPasRecordType.IsAdvancedRecord: Boolean; Var  I : Integer;  Member: TPasElement; begin  Result:=False;  I:=0;  While (Not Result) and (I<Members.Count) do    begin    Member:=TPasElement(Members[i]);    if (Member.Visibility<>visPublic) then exit(true);    if (Member.ClassType<>TPasVariable) then exit(true);    Inc(I);    end;end;The while loop contains a useless "(Not Result)" condition. The result is false at the loop entry and it's changed only using "exit(true);" statements.
The attached patch changes "While (Not Result) and (I<Members.Count) do" to "While I<Members.Count do".

AlexTP:
Reported to https://gitlab.com/freepascal.org/fpc/source/-/issues/40539

Navigation

[0] Message Index

Go to full version