Esempio n. 1
0
        /// <summary>
        /// Binds a LambdaToken to metadata.
        /// </summary>
        /// <param name="lambdaToken">Token to bind.</param>
        /// <param name="state">Object to hold the state of binding.</param>
        /// <returns>A metadata bound any or all node.</returns>
        internal LambdaNode BindLambdaToken(LambdaToken lambdaToken, BindingState state)
        {
            ExceptionUtils.CheckArgumentNotNull(lambdaToken, "LambdaToken");
            ExceptionUtils.CheckArgumentNotNull(state, "state");

            // Start by binding the parent token
            CollectionNode parent        = this.BindParentToken(lambdaToken.Parent);
            RangeVariable  rangeVariable = null;

            // Add the lambda variable to the stack
            if (lambdaToken.Parameter != null)
            {
                rangeVariable = NodeFactory.CreateParameterNode(lambdaToken.Parameter, parent);
                state.RangeVariables.Push(rangeVariable);
            }

            // Bind the expression
            SingleValueNode expression = this.BindExpressionToken(lambdaToken.Expression);

            // Create the node
            LambdaNode lambdaNode = NodeFactory.CreateLambdaNode(state, parent, expression, rangeVariable, lambdaToken.Kind);

            // Remove the lambda variable as it is now out of scope
            if (rangeVariable != null)
            {
                state.RangeVariables.Pop();
            }

            return(lambdaNode);
        }
Esempio n. 2
0
        /// <summary>
        /// Binds a LambdaToken.
        /// </summary>
        /// <param name="lambdaToken">The LambdaToken to bind.</param>
        /// <returns>A bound Any or All node.</returns>
        protected virtual QueryNode BindAnyAll(LambdaToken lambdaToken)
        {
            ExceptionUtils.CheckArgumentNotNull(lambdaToken, "LambdaToken");

            LambdaBinder binder = new LambdaBinder(this.Bind);

            return(binder.BindLambdaToken(lambdaToken, this.BindingState));
        }
 /// <summary>
 /// Visits a LambdaToken
 /// </summary>
 /// <param name="tokenIn">The LambdaToken to visit</param>
 /// <returns>A LambdaNode bound to this LambdaToken</returns>
 public virtual T Visit(LambdaToken tokenIn)
 {
     throw new NotImplementedException();
 }