更新异步step
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Convention.RScript.Parser;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Convention.RScript
|
||||
@@ -23,7 +24,7 @@ namespace Convention.RScript
|
||||
else if (context.NamespaceLayer.TryGetValue(context.RuntimePointerStack.Peek(), out var exitPointer))
|
||||
{
|
||||
context.CurrentRuntimePointer = exitPointer;
|
||||
context.SentenceRunners[RScriptSentence.Mode.ExitNamespace].Run(parser, context.CurrentSentence, context);
|
||||
return context.SentenceRunners[RScriptSentence.Mode.ExitNamespace].Run(parser, context.CurrentSentence, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -32,5 +33,27 @@ namespace Convention.RScript
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
[return: MaybeNull]
|
||||
public IEnumerator RunAsync(ExpressionParser parser, RScriptSentence sentence, RScriptContext context)
|
||||
{
|
||||
// 检查并跳转到当前命名空间的结束位置
|
||||
if (parser.Evaluate<bool>(sentence.content))
|
||||
{
|
||||
if (context.RuntimePointerStack.Count == 0)
|
||||
{
|
||||
context.CurrentRuntimePointer = context.Sentences.Length;
|
||||
}
|
||||
else if (context.NamespaceLayer.TryGetValue(context.RuntimePointerStack.Peek(), out var exitPointer))
|
||||
{
|
||||
context.CurrentRuntimePointer = exitPointer;
|
||||
yield return context.SentenceRunners[RScriptSentence.Mode.ExitNamespace].RunAsync(parser, context.CurrentSentence, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RScriptRuntimeException($"No namespace to break.", context.CurrentRuntimePointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user