public static IExpression ParseAsync(ParseInfo parseInfo, Scope scope, AsyncContext context, bool usedAsValue) { AsyncInfo asyncInfo = new AsyncInfo(context.IgnoreIfRunning ? CallParallel.AlreadyRunning_DoNothing : CallParallel.AlreadyRunning_RestartRule); var result = parseInfo.SetAsyncInfo(asyncInfo).GetExpression(scope, context.Expression, usedAsValue: usedAsValue); if (!asyncInfo._canBeCalledInParallel) { parseInfo.Script.Diagnostics.Error(asyncInfo._message ?? "This expression cannot be executed asynchronously", context.AsyncToken.Range); } return(result); }