Ejemplo n.º 1
0
 public static Doc Print(SelectClauseSyntax node)
 {
     return(Doc.Concat(
                Token.PrintWithSuffix(node.SelectKeyword, " "),
                Node.Print(node.Expression)
                ));
 }
Ejemplo n.º 2
0
        public override void VisitSelectClause(SelectClauseSyntax node)
        {
            IncrementNodeCount(2); // direct equivalent of the SQL `SELECT` clause
            AddOperator("select");

            base.VisitSelectClause(node);
        }
Ejemplo n.º 3
0
        private LuaExpressionSyntax BuildQuerySelect(LuaExpressionSyntax collection, SelectClauseSyntax node, IQueryRangeVariable rangeVariable)
        {
            var selectFunction = new LuaFunctionExpressionSyntax();

            PushFunction(selectFunction);
            selectFunction.AddParameter(rangeVariable.Name);

            var expression = (LuaExpressionSyntax)node.Expression.Accept(this);

            if (node.Expression.IsKind(SyntaxKind.IdentifierName))
            {
                if (expression is LuaIdentifierNameSyntax identifierName && identifierName.ValueText == rangeVariable.Name.ValueText)
                {
                    PopFunction();
                    return(collection);
                }
            }

            selectFunction.AddStatement(new LuaReturnStatementSyntax(expression));
            PopFunction();
            var type           = semanticModel_.GetTypeInfo(node.Expression).Type;
            var typeExpression = GetTypeName(type);

            return(new LuaInvocationExpressionSyntax(LuaIdentifierNameSyntax.LinqSelect, collection, selectFunction, typeExpression));
        }
Ejemplo n.º 4
0
 private Doc PrintSelectClauseSyntax(SelectClauseSyntax node)
 {
     return(Concat(
                this.PrintSyntaxToken(node.SelectKeyword, " "),
                this.Print(node.Expression)
                ));
 }
        private VariableState VisitSelectClause(SelectClauseSyntax selectClauseSyntax, ExecutionState state)
        {
            var finalState = new VariableState(selectClauseSyntax, VariableTaint.Unset);

            foreach (var variable in selectClauseSyntax.Variables)
            {
                finalState.MergeTaint(VisitNode(variable, state).Taint);
            }

            return(finalState);
        }
Ejemplo n.º 6
0
        public override void VisitSelectClause(SelectClauseSyntax node)
        {
            var paramInfo  = m_LinqParamInfoStack.Peek();
            var paramNames = paramInfo.ParamNames;

            CodeBuilder.AppendFormat("select(function({0}){{ return(", string.Join(", ", paramNames.ToArray()));
            var opd = m_Model.GetOperation(node.Expression) as IConversionExpression;

            OutputExpressionSyntax(node.Expression, opd);
            CodeBuilder.Append("); })");
        }
        public override SyntaxNode VisitSelectClause(SelectClauseSyntax node)
        {
            if (!_visitQuerySyntax)
            {
                return(base.VisitSelectClause(node));
            }

            var selectExpression = (ExpressionSyntax)SetFlagAndVisit(node.Expression);

            return(BuildFluentInvocation("Select", BuildSimpleLambdaExpression(selectExpression)));
        }
Ejemplo n.º 8
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     Visit(node.Expression);
     foreach (string variable in _fromVariables.Where(v => v.Value == _linqIndex).Select(v => v.Key).ToList())
     {
         AddProperties(GetProperties(_variables[variable]));
         _fromVariables.Remove(variable);
         _variables.Remove(variable);
     }
     _linqIndex--;
     _proceed = true;
 }
Ejemplo n.º 9
0
        public override void VisitSelectClause(SelectClauseSyntax node)
        {
            if (!PreVisit(node))
            {
                return;
            }

            node.Expression?.Accept(this);

            base.VisitSelectClause(node);

            PostVisit(node);
        }
Ejemplo n.º 10
0
        public override void VisitSelectClause(SelectClauseSyntax node)
        {
            var    paramInfo  = m_LinqParamInfoStack.Peek();
            var    paramNames = paramInfo.ParamNames;
            string prestr     = paramInfo.Prestr;

            paramInfo.Prestr = ", ";

            CodeBuilder.AppendFormat("{0}{{\"select\", (function({1}) return ", prestr, string.Join(", ", paramNames.ToArray()));
            var opd = m_Model.GetOperation(node.Expression) as IConversionExpression;

            OutputExpressionSyntax(node.Expression, opd);
            CodeBuilder.Append("; end)}");
        }
Ejemplo n.º 11
0
        private LuaExpressionSyntax BuildQuerySelect(LuaExpressionSyntax collection, SelectClauseSyntax node, LuaIdentifierNameSyntax rangeVariable)
        {
            var expression = (LuaExpressionSyntax)node.Expression.Accept(this);

            if (node.Expression.IsKind(SyntaxKind.IdentifierName))
            {
                var identifierName = expression as LuaIdentifierNameSyntax;
                if (identifierName != null && identifierName.ValueText == rangeVariable.ValueText)
                {
                    return(collection);
                }
            }
            var type           = semanticModel_.GetTypeInfo(node.Expression).Type;
            var typeExpression = GetTypeName(type);

            return(new LuaInvocationExpressionSyntax(LuaIdentifierNameSyntax.LinqSelect, collection, expression, typeExpression));
        }
Ejemplo n.º 12
0
        public void VisitSelectClause(SelectClauseSyntax node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            node.Validate();

            if (!_writer.Configuration.LineBreaksAndWrapping.Other.PlaceLinqExpressionOnSingleLine)
            {
                _writer.Break(true);
            }

            _writer.WriteKeyword(PrinterKeyword.Select);
            _writer.WriteSpace();
            node.Expression.Accept(this);
        }
Ejemplo n.º 13
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     return;
 }
Ejemplo n.º 15
0
        public override void VisitSelectClause(SelectClauseSyntax node)
        {
            node.Expression?.Accept(this);

            base.VisitSelectClause(node);
        }
Ejemplo n.º 16
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }
            public override void VisitSelectClause(SelectClauseSyntax node)
            {
                var saveCurrentScope = currentScope;
                currentScope = new DeclarationScope(currentScope);

                Visit(node.Expression);

                Debug.Assert(currentScope.Parent == saveCurrentScope);
                currentScope = saveCurrentScope;
            }
Ejemplo n.º 18
0
 public TameSelectClauseSyntax(SelectClauseSyntax node)
 {
     Node = node;
     AddChildren();
 }
Ejemplo n.º 19
0
 public virtual TResult VisitSelectClause(SelectClauseSyntax node)
 {
     return(DefaultVisit(node));
 }
Ejemplo n.º 20
0
 /// <inheritdoc />
 public override Expression VisitSelectClause(SelectClauseSyntax node)
 {
     throw Unexpected(node, nameof(VisitQueryExpression));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitSelectClause(SelectClauseSyntax node)
 {
     this.OnNodeVisited(node);
     if (!this.traverseRootOnly) base.VisitSelectClause(node);
 }
 public override LuaSyntaxNode VisitSelectClause(SelectClauseSyntax node)
 {
     throw new InvalidOperationException();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitSelectClause(SelectClauseSyntax node)
 {
     this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
     base.VisitSelectClause(node);
 }
Ejemplo n.º 24
0
 public override SyntaxNode VisitSelectClause(SelectClauseSyntax node)
 {
     node = (SelectClauseSyntax)base.VisitSelectClause(node);
     Classes.Add(node);
     return(node);
 }
Ejemplo n.º 25
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     base.VisitSelectClause(node);
 }
Ejemplo n.º 26
0
        public override Evaluation VisitSelectClause(SelectClauseSyntax node)
        {
            node.Expression?.Accept <Evaluation>(this);

            return(base.VisitSelectClause(node));
        }
Ejemplo n.º 27
0
 public virtual void VisitSelectClause(SelectClauseSyntax node)
 {
     DefaultVisit(node);
 }
Ejemplo n.º 28
0
 public override void VisitSelectClause(SelectClauseSyntax node)
 {
     Visit(node.Expression);
     foreach (string variable in _fromVariables.Where(v => v.Value == _linqIndex).Select(v => v.Key).ToList())
     {
         AddProperties(GetProperties(_variables[variable]));
         _fromVariables.Remove(variable);
         _variables.Remove(variable);
     }
     _linqIndex--;
     _proceed = true;
 }
Ejemplo n.º 29
0
        public void VisitSelectClause(SelectClauseSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            if (!_writer.Configuration.LineBreaksAndWrapping.Other.PlaceLinqExpressionOnSingleLine)
                _writer.Break(true);

            _writer.WriteKeyword(PrinterKeyword.Select);
            _writer.WriteSpace();
            node.Expression.Accept(this);
        }
 //
 // Summary:
 //     Called when the visitor visits a SelectClauseSyntax node.
 public virtual void VisitSelectClause(SelectClauseSyntax node);