修复了一些bug

This commit is contained in:
2025-11-26 17:58:30 +08:00
parent 2f24d94db2
commit 88b0edfe6a
4 changed files with 18 additions and 3 deletions

View File

@@ -22,7 +22,14 @@ namespace Convention.RScript.Runner
// 还原上层命名空间的变量
foreach (var local in context.CurrentLocalSpaceVariableNames.Peek())
{
parser.context.Variables[local] = context.Variables[local].data;
if (context.Variables.ContainsKey(local))
{
parser.context.Variables[local] = context.Variables[local].data;
}
else
{
parser.context.Variables.Remove(local);
}
}
context.CurrentLocalSpaceVariableNames.Pop();
// 弹栈