From 851b34f6381572f279da68fa52e2dbb740d9c3cb Mon Sep 17 00:00:00 2001 From: Mr-Rm Date: Fri, 26 Jul 2024 15:15:12 +0400 Subject: [PATCH] =?UTF-8?q?fix=20#1427:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D1=81=D0=BA?= =?UTF-8?q?=D1=80=D1=83=D1=82=D0=BA=D0=B8=20=D1=81=D1=82=D0=B5=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=B8=D1=81=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B2=20=D0=92=D1=8B=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BD=D0=B8=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/NUnitTests/ContextTests.cs | 23 +++++++++++++++++++++ src/ScriptEngine/Machine/MachineInstance.cs | 1 + 2 files changed, 24 insertions(+) diff --git a/src/NUnitTests/ContextTests.cs b/src/NUnitTests/ContextTests.cs index 50717be36..e8425ca4e 100644 --- a/src/NUnitTests/ContextTests.cs +++ b/src/NUnitTests/ContextTests.cs @@ -565,6 +565,29 @@ public void TestICallDeprecatedAliasAndHaveException() Assert.IsTrue(exceptionThrown, "Безнадёжно устаревший метод должен вызвать исключение"); } + [Test] + public void TestICallExecuteWithException() + { + SystemLogger.SetWriter(this); + _messages.Clear(); + var exceptionThrown = false; + + try + { + host.RunTestString( + @"Попытка + Выполнить(""Г=1/0""); + Исключение + КонецПопытки;"); + } + catch + { + exceptionThrown = true; + } + + Assert.IsFalse(exceptionThrown, "Перехваченное в Выполнить исключение не должно вызывать внешнее"); + } + public void Write(string text) { _messages.Add(text); diff --git a/src/ScriptEngine/Machine/MachineInstance.cs b/src/ScriptEngine/Machine/MachineInstance.cs index dc5c34a48..ce9e90f66 100644 --- a/src/ScriptEngine/Machine/MachineInstance.cs +++ b/src/ScriptEngine/Machine/MachineInstance.cs @@ -1458,6 +1458,7 @@ private void Execute(int arg) ModuleLoadIndex = _scopes.Count - 1, Locals = new IVariable[method.Variables.Count], InstructionPointer = 0, + IsReentrantCall = true }; PushFrame(frame); CreateCurrentFrameLocals(method.Variables);