Skip to content

Commit

Permalink
Merge pull request #1428 from Mr-Rm/fix/1427
Browse files Browse the repository at this point in the history
fix #1427: исправление раскрутки стека при исключении в Выполнить, с тестом
  • Loading branch information
EvilBeaver authored Jul 31, 2024
2 parents 7992509 + 851b34f commit 133c26b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/NUnitTests/ContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/ScriptEngine/Machine/MachineInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 133c26b

Please sign in to comment.