瀏覽代碼

* More efficient condition checks for "tnodeutils.has_init_list"

J. Gareth "Curious Kit" Moreton 1 年之前
父節點
當前提交
a4ff1d185e
共有 1 個文件被更改,包括 10 次插入5 次删除
  1. 10 5
      compiler/ngenutil.pas

+ 10 - 5
compiler/ngenutil.pas

@@ -1235,18 +1235,23 @@ implementation
     var
       hp : tused_unit;
     begin
-      Result:=false;
+      Result := True;
+
+      { Check current module first }
+      if mf_init in current_module.moduleflags then
+        Exit;
+
       { Check used units }
       hp:=tused_unit(usedunits.first);
-      while assigned(hp) and (Result=false) do
+      while assigned(hp) do
         begin
           if mf_init in hp.u.moduleflags then
-            Result:=true;
+            Exit;
           hp:=tused_unit(hp.next);
         end;
 
-      { Check current module }
-      Result:=Result or (mf_init in current_module.moduleflags);
+      { We reach this point, none of the used units have an initialisation list }
+      Result := False;
     end;