From 7d0bb3a62d2ff61f4f25a12e5ab51169a7457c61 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Mon, 1 May 2023 10:20:12 +0200 Subject: [PATCH] fix pascalabcnet/pascalabcnetide#261 --- CodeCompletion/SymTable.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index 2a77e9a76..0d8c3d093 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -491,17 +491,23 @@ namespace CodeCompletion return lst; } - private bool hasUsesCycle(SymScope unit) + private bool hasUsesCycle(SymScope unit, int deep=0) { if (unit.Name == "PABCSystem") return true; + if (deep > 100) + return true; if (this.used_units != null) for (int i = 0; i < this.used_units.Count; i++) { if (this.used_units[i] == unit || this.used_units[i] == this) return true; - else if (this.used_units[i].hasUsesCycle(unit)) - return true; + else + { + if (this.used_units[i].hasUsesCycle(unit, deep+1)) + return true; + } + } return false; }