错误程序子程序优化

This commit is contained in:
“hsc”
2026-08-07 14:54:01 +08:00
parent 80a2cbd80b
commit 99ac3f2b8d
9 changed files with 261 additions and 149 deletions
@@ -568,20 +568,38 @@ namespace TestingModule.ViewModels
{
// 查找最近的未匹配循环开始
StepVM? lastUnmatchedLoopStart = null;
for (int i = Program.StepCollection.Count - 1; i >= 0; i--)
if (_ScopedContext.SelectedStepList == "主程序")
{
if (Program.StepCollection[i].StepType == "循环开始")
for (int i = Program.StepCollection.Count - 1; i >= 0; i--)
{
bool isMatched = Program.StepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
if (Program.StepCollection[i].StepType == "循环开始")
{
lastUnmatchedLoopStart = Program.StepCollection[i];
break;
bool isMatched = Program.StepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
{
lastUnmatchedLoopStart = Program.StepCollection[i];
break;
}
}
}
}
else
{
for (int i = Program.ErrorStepCollection.Count - 1; i >= 0; i--)
{
if (Program.ErrorStepCollection[i].StepType == "循环开始")
{
bool isMatched = Program.ErrorStepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
{
lastUnmatchedLoopStart = Program.ErrorStepCollection[i];
break;
}
}
}
}
var newStep = new StepVM
{
Name = "循环结束",