Esempio n. 1
0
 /// <summary>
 /// Like <see cref="TryEvaluateAndDescribeAsync(IRExpressionEvaluator, string, string, string, REvaluationResultProperties, string, CancellationToken)"/>,
 /// but evaluates in the global environment (<c>.GlobalEnv</c>), and the result is not named.
 /// </summary>
 public static Task <IREvaluationResultInfo> TryEvaluateAndDescribeAsync(
     this IRExpressionEvaluator session,
     string expression,
     REvaluationResultProperties properties,
     string repr,
     CancellationToken cancellationToken = default(CancellationToken)
     ) =>
 session.TryEvaluateAndDescribeAsync(REnvironments.GlobalEnv, expression, null, properties, repr, cancellationToken);
Esempio n. 2
0
        /// <summary>
        /// Like <see cref="TryEvaluateAndDescribeAsync(IRSession, string, string, string, REvaluationResultProperties, string, CancellationToken)"/>,
        /// but throws <see cref="RException"/> if result is an <see cref="IRErrorInfo"/>.
        /// </summary>
        public static async Task <IRValueInfo> EvaluateAndDescribeAsync(
            this IRExpressionEvaluator session,
            string environmentExpression,
            string expression,
            string name,
            REvaluationResultProperties properties,
            string repr,
            CancellationToken cancellationToken = default(CancellationToken)
            )
        {
            var info = await session.TryEvaluateAndDescribeAsync(environmentExpression, expression, name, properties, repr, cancellationToken);

            var error = info as IRErrorInfo;

            if (error != null)
            {
                throw new RException(error.ErrorText);
            }

            Debug.Assert(info is IRValueInfo);
            return((IRValueInfo)info);
        }