From d144d091f504aedd8a35b7a30533c6e65a425594 Mon Sep 17 00:00:00 2001 From: SunSerega Date: Sun, 27 Sep 2020 20:16:36 +0300 Subject: [PATCH] cleanup --- Compiler/PCU/PCUWriter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Compiler/PCU/PCUWriter.cs b/Compiler/PCU/PCUWriter.cs index da41ea924..f2e805fcb 100644 --- a/Compiler/PCU/PCUWriter.cs +++ b/Compiler/PCU/PCUWriter.cs @@ -1029,6 +1029,9 @@ namespace PascalABCCompiler.PCU // конечно, записи в unit_uses_paths для такого подключения - нет if (unit.SemanticTree == used_unit) continue; + // AddIndirectInteraceUsedUnits может добавлять один и тот же модуль несколько раз + if (used_units.ContainsKey(used_unit)) continue; + // раньше вместо пути модуля - брало имя его первого пространства имён // и сразу стояла эта проверка. Если будет тут вылетать - наверное надо заменить throw на continue if (used_unit.namespaces.Count == 0) throw new InvalidOperationException(); @@ -1040,7 +1043,7 @@ namespace PascalABCCompiler.PCU foreach (var used_unit in unit.ImplementationUsedUnits.OfType()) { if (unit.SemanticTree == used_unit) continue; - if (used_units.ContainsKey(used_unit)) continue; //AddIndirectImplementationUsedUnits может добавить модуль из uses из interface + if (used_units.ContainsKey(used_unit)) continue; if (used_unit.namespaces.Count == 0) throw new InvalidOperationException(); this.used_units.Add(used_unit, used_units.Count);