コード例 #1
0
 /// <summary>
 /// Evaluates call to a function with a specific set of arguments.
 /// Intended to be used when function return type was not possible
 /// to determine from its return annotation or via basic evaluation.
 /// </summary>
 /// <remarks>
 /// This is different from evaluation in <see cref="FunctionEvaluator"/>
 /// that that checks for the return type annotation and attempts to determine
 /// static return type.
 /// </remarks>
 public IMember EvaluateCall(IArgumentSet args)
 {
     // Open scope and declare parameters
     using (_eval.OpenScope(_declaringModule, _function, out _)) {
         args.DeclareParametersInScope(_eval);
         _function.Body?.Walk(this);
     }
     return(_result);
 }
コード例 #2
0
        /// <summary>
        /// Evaluates call to a function with a specific set of arguments.
        /// Intended to be used when function return type was not possible
        /// to determine from its return annotation or via basic evaluation.
        /// </summary>
        /// <remarks>
        /// This is different from evaluation in <see cref="FunctionEvaluator"/>
        /// that that checks for the return type annotation and attempts to determine
        /// static return type.
        /// </remarks>
        public async Task <IMember> EvaluateCallAsync(IArgumentSet args, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            // Open scope and declare parameters
            using (_eval.OpenScope(_function, out _)) {
                args.DeclareParametersInScope(_eval);
                await _function.Body.WalkAsync(this, cancellationToken);
            }
            return(_result);
        }