Beispiel #1
0
        ZilResult ApplyImpl([NotNull] Context ctx, [ItemNotNull][NotNull] ZilObject[] args, bool eval)
        {
            using (var application = argspec.BeginApply(ctx, args, eval))
            {
                if (application.EarlyResult != null)
                {
                    return(application.EarlyResult.Value);
                }

                var activation = application.Activation;
                do
                {
                    var result = EvalProgram(ctx, body);
                    if (result.IsReturn(activation, out var value))
                    {
                        argspec.ValidateResult(ctx, value);
                        return(value);
                    }

                    if (result.IsAgain(activation))
                    {
                        // repeat
                        continue;
                    }

                    return(result);
                } while (true);
            }
        }