更新异步step
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Convention.RScript.Parser;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Convention.RScript.Runner
|
||||
@@ -24,5 +25,20 @@ namespace Convention.RScript.Runner
|
||||
context.RuntimePointerStack.Push(context.CurrentRuntimePointer);
|
||||
return null;
|
||||
}
|
||||
|
||||
[return: MaybeNull]
|
||||
public IEnumerator RunAsync(ExpressionParser parser, RScriptSentence sentence, RScriptContext context)
|
||||
{
|
||||
// 准备记录当前命名空间中定义的变量, 清空上层命名空间的变量
|
||||
context.CurrentLocalSpaceVariableNames.Push(new());
|
||||
// 更新变量值
|
||||
foreach (var (varName, varValue) in parser.context.Variables)
|
||||
{
|
||||
context.Variables.SetValue(varName, varValue);
|
||||
}
|
||||
// 压栈
|
||||
context.RuntimePointerStack.Push(context.CurrentRuntimePointer);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user