Przeglądaj źródła

* better estimation of callparanode complexity

git-svn-id: trunk@31038 -
florian 10 lat temu
rodzic
commit
919c539ff5
1 zmienionych plików z 17 dodań i 2 usunięć
  1. 17 2
      compiler/nutils.pas

+ 17 - 2
compiler/nutils.pas

@@ -737,9 +737,24 @@ implementation
                   p := tunarynode(p).left;
                 end;
               labeln,
-              blockn,
-              callparan:
+              blockn:
                 p := tunarynode(p).left;
+              callparan:
+                begin
+                  { call to decr? }
+                  if is_managed_type(tunarynode(p).left.resultdef) and (tcallparanode(p).parasym.varspez=vs_out) then
+                    begin
+                      result:=NODE_COMPLEXITY_INF;
+                      exit;
+                    end
+                  else
+                    begin
+                      inc(result);
+                      if (result = NODE_COMPLEXITY_INF) then
+                        exit;
+                      p := tunarynode(p).left;
+                    end;
+                end;
               notn,
               derefn :
                 begin