From cda2ab00978f3a53ecf987e487591107cf96fe57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?=
=?UTF-8?q?=D0=97=D0=B5=D0=BC=D0=BB=D1=8F=D0=BA?=
<92867056+AlexanderZemlyak@users.noreply.github.com>
Date: Thu, 9 Apr 2026 09:46:26 +0300
Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?=
=?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B8?=
=?UTF-8?q?=20=D0=BA=D1=8D=D1=88=D0=B0=20=D1=82=D0=B8=D0=BF=D0=B8=D0=B7?=
=?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=84?=
=?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=B8=20=D0=BC=D0=BD=D0=BE?=
=?UTF-8?q?=D0=B6=D0=B5=D1=81=D1=82=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D0=B8?=
=?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?=
=?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B8=D1=87=D0=B8=D0=B9=20=D0=B2=20pcu=20?=
=?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=D1=85=20(#3408)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Fix cache of typed files, typed sets and short strings clearing
* Delete ShortStringTypes clearing
* Add doc comments
* Return ShortStringTypes clearing in reset method
---
.../TreeConversion/compilation_context.cs | 16 +++++++++++++---
.../TreeConversion/syntax_tree_visitor.cs | 13 ++++++++++++-
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/TreeConverter/TreeConversion/compilation_context.cs b/TreeConverter/TreeConversion/compilation_context.cs
index 1d3389e29..b5b03a338 100644
--- a/TreeConverter/TreeConversion/compilation_context.cs
+++ b/TreeConverter/TreeConversion/compilation_context.cs
@@ -292,7 +292,19 @@ namespace PascalABCCompiler.TreeConverter
}
return false;
}
-
+
+ ///
+ /// Очистка переменных перед компиляцией интерфейсной или имплементационной части модуля
+ ///
+ public void ResetBeforeModuleCompilation()
+ {
+ // Эти кэши нужно очищать перед компиляцией модуля, потому что иначе
+ // в pcu файлы будет записываться разное кол-во типов оттуда в зависимости от того,
+ // использовались ли они в других модулях, которые компилировались ранее EVA 26.03.2026
+ TypedFiles.Clear();
+ TypedSets.Clear();
+ }
+
public void reset()
{
//CurrentHandlerList = null; // SSM 29/03/22 - не сработало
@@ -310,9 +322,7 @@ namespace PascalABCCompiler.TreeConverter
type_stack.Clear();
clear_special_local_vars();
_scope_stack.Clear();
- TypedFiles.Clear();
ShortStringTypes.Clear();
- TypedSets.Clear();
_compiled_tn = null;
_explicit_interface_type = null;
_ctt = null;
diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs
index c444962d7..c683cd8d1 100644
--- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs
+++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs
@@ -178,7 +178,10 @@ namespace PascalABCCompiler.TreeConverter
///
/// Можно переопределять для добавления действий перед конвертацией интерфейсной и имплементационной частей
///
- public virtual void BeforeCompilationActions() { }
+ public virtual void BeforeCompilationActions()
+ {
+ ResetBeforeModuleCompilation();
+ }
///
/// Можно переопределять для добавления действий после конвертации интерфейсной и имплементационной частей
@@ -659,6 +662,14 @@ namespace PascalABCCompiler.TreeConverter
}
}
+ ///
+ /// Очистка переменных перед компиляцией интерфейсной или имплементационной части модуля
+ ///
+ private void ResetBeforeModuleCompilation()
+ {
+ context.ResetBeforeModuleCompilation();
+ }
+
public void Reset()
{
_system_unit = null;