Beispiel #1
0
    public static R RunExpression <R>(CFlat cflat, string source, out CallAssertion assertion)
        where R : struct, IMarshalable
    {
        var compileErrors = cflat.CompileExpression(source, CompilerMode);

        if (compileErrors.count > 0)
        {
            throw new CompileErrorException(cflat.GetFormattedCompileErrors());
        }

        assertion = new CallAssertion(source, cflat);
        var function = cflat.GetFunction <Empty, R>(string.Empty);

        if (!function.isSome)
        {
            throw new FunctionNotFoundException();
        }

        return(function.value.Call(cflat, new Empty()));
    }
Beispiel #2
0
 public static R RunExpression <R>(string source, out CallAssertion assertion)
     where R : struct, IMarshalable
 {
     return(RunExpression <R>(new CFlat(), source, out assertion));
 }