Ejemplo n.º 1
0
 /// <summary>
 /// Returns what symbol, if any, the specified ordering syntax bound to.
 /// </summary>
 /// <param name="semanticModel"></param>
 /// <param name="ordering"></param>
 /// <param name="cancellationToken"></param>
 public static ISymbol GetSymbol(
     this SemanticModel semanticModel,
     OrderingSyntax ordering,
     CancellationToken cancellationToken = default)
 {
     return(Microsoft.CodeAnalysis.CSharp.CSharpExtensions
            .GetSymbolInfo(semanticModel, ordering, cancellationToken)
            .Symbol);
 }
Ejemplo n.º 2
0
        public override void VisitOrdering(OrderingSyntax node)
        {
            var paramInfo  = m_LinqParamInfoStack.Peek();
            var paramNames = paramInfo.ParamNames;

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

            OutputExpressionSyntax(node.Expression, opd);
            CodeBuilder.AppendFormat("); }}), {0})", node.AscendingOrDescendingKeyword.Text != "descending" ? "true" : "false");
        }
Ejemplo n.º 3
0
        public override void VisitOrdering(OrderingSyntax node)
        {
            if (!PreVisit(node))
            {
                return;
            }

            node.Expression?.Accept(this);

            base.VisitOrdering(node);

            PostVisit(node);
        }
        private InvocationExpressionSyntax HandleOrderByExpression(OrderingSyntax orderingSyntax, bool firstOrderExpression)
        {
            var orderExpression = (ExpressionSyntax)SetFlagAndVisit(orderingSyntax.Expression);

            var orderByThenBy = firstOrderExpression ? "OrderBy" : "ThenBy";

            orderByThenBy += orderingSyntax.AscendingOrDescendingKeyword.ValueText?.ToLower() == "descending"
                                 ? "Descending"
                                 : "";

            InvocationExpressionSyntax orderByInvocationvocation = BuildFluentInvocation(
                orderByThenBy,
                BuildSimpleLambdaExpression(orderExpression));

            return(orderByInvocationvocation);
        }
Ejemplo n.º 5
0
        public void VisitOrdering(OrderingSyntax node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            node.Validate();

            node.Expression.Accept(this);

            if (node.Kind != AscendingOrDescending.Ascending)
            {
                _writer.WriteSpace();
                _writer.WriteKeyword(PrinterKeyword.Descending);
            }
        }
Ejemplo n.º 6
0
        public override SyntaxNode VisitOrdering(OrderingSyntax node)
        {
            node = (OrderingSyntax)base.VisitOrdering(node);

            var orderingKind = node.AscendingOrDescendingKeyword;

            if ((transformKind == TransformKind.OrderByAscToOrderByDesc) && (orderingKind.Kind() == SyntaxKind.AscendingKeyword))
            {
                var descToken = SyntaxFactory.Token(orderingKind.LeadingTrivia, SyntaxKind.DescendingKeyword, orderingKind.TrailingTrivia);

                return(SyntaxFactory.Ordering(SyntaxKind.DescendingOrdering, node.Expression, descToken));
            }

            if ((transformKind == TransformKind.OrderByDescToOrderByAsc) && (orderingKind.Kind() == SyntaxKind.DescendingKeyword))
            {
                var ascToken = SyntaxFactory.Token(orderingKind.LeadingTrivia, SyntaxKind.AscendingKeyword, orderingKind.TrailingTrivia);

                return(SyntaxFactory.Ordering(SyntaxKind.AscendingOrdering, node.Expression, ascToken));
            }

            return(node);
        }
Ejemplo n.º 7
0
        public override void VisitOrdering(OrderingSyntax node)
        {
            node.Expression?.Accept(this);

            base.VisitOrdering(node);
        }
Ejemplo n.º 8
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     throw new NotImplementedException();
 }
            public override void VisitOrdering(OrderingSyntax node)
            {
                var saveCurrentScope = currentScope;
                currentScope = new DeclarationScope(currentScope);

                Visit(node.Expression);

                Debug.Assert(currentScope.Parent == saveCurrentScope);
                currentScope = saveCurrentScope;
            }
Ejemplo n.º 10
0
 public override void VisitOrdering(OrderingSyntax queryOrdering)
 {
     base.VisitOrdering(queryOrdering);
     _indexData.HasOrder = true;
 }
Ejemplo n.º 11
0
        public override SyntaxNode VisitOrdering(OrderingSyntax node)
        {
            node = (OrderingSyntax)base.VisitOrdering(node);

            var orderingKind = node.AscendingOrDescendingKeyword;

            if ((transformKind == TransformKind.OrderByAscToOrderByDesc) && (orderingKind.Kind() == SyntaxKind.AscendingKeyword))
            {
                var descToken = SyntaxFactory.Token(orderingKind.LeadingTrivia, SyntaxKind.DescendingKeyword, orderingKind.TrailingTrivia);

                return SyntaxFactory.Ordering(SyntaxKind.DescendingOrdering, node.Expression, descToken);
            }

            if ((transformKind == TransformKind.OrderByDescToOrderByAsc) && (orderingKind.Kind() == SyntaxKind.DescendingKeyword))
            {
                var ascToken = SyntaxFactory.Token(orderingKind.LeadingTrivia, SyntaxKind.AscendingKeyword, orderingKind.TrailingTrivia);

                return SyntaxFactory.Ordering(SyntaxKind.AscendingOrdering, node.Expression, ascToken);
            }

            return node;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Gets the semantic information for an ordering clause in an orderby query clause.
 /// </summary>
 public abstract SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken));
Ejemplo n.º 13
0
 public override SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (Logger.LogBlock(FunctionId.CSharp_SemanticModel_GetSymbolInfo, message: this.SyntaxTree.FilePath, cancellationToken: cancellationToken))
     {
         CheckSyntaxNode(node);
         var model = this.GetMemberModel(node);
         return (model == null) ? default(SymbolInfo) : model.GetSymbolInfo(node, cancellationToken);
     }
 }
Ejemplo n.º 14
0
 public TameOrderingSyntax(OrderingSyntax node)
 {
     Node = node;
     AddChildren();
 }
Ejemplo n.º 15
0
        public void VisitOrdering(OrderingSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            node.Expression.Accept(this);

            if (node.Kind != AscendingOrDescending.Ascending)
            {
                _writer.WriteSpace();
                _writer.WriteKeyword(PrinterKeyword.Descending);
            }
        }
Ejemplo n.º 16
0
 public override void VisitOrdering(OrderingSyntax node)
 {
 }
Ejemplo n.º 17
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     base.VisitOrdering(node);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitOrdering(OrderingSyntax node)
 {
     this.OnNodeVisited(node);
     if (!this.traverseRootOnly) base.VisitOrdering(node);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitOrdering(OrderingSyntax node)
 {
     this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
     base.VisitOrdering(node);
 }
        private LuaExpressionSyntax BuildOrdering(LuaIdentifierNameSyntax methodName, LuaExpressionSyntax collection, OrderingSyntax node, IQueryRangeVariable rangeVariable)
        {
            var type        = semanticModel_.GetTypeInfo(node.Expression).Type;
            var typeName    = GetTypeName(type);
            var expression  = (LuaExpressionSyntax)node.Expression.Accept(this);
            var keySelector = new LuaFunctionExpressionSyntax();

            keySelector.AddParameter(rangeVariable.Name);
            keySelector.AddStatement(new LuaReturnStatementSyntax(expression));
            return(new LuaInvocationExpressionSyntax(methodName, collection, keySelector, LuaIdentifierNameSyntax.Nil, typeName));
        }
Ejemplo n.º 21
0
 public override SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken))
 {
     CheckSyntaxNode(node);
     var model = this.GetMemberModel(node);
     return (model == null) ? default(SymbolInfo) : model.GetSymbolInfo(node, cancellationToken);
 }
Ejemplo n.º 22
0
 public SymbolInfo GetSymbolInfo(OrderingSyntax node,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return GetSemanticModel(node).GetSymbolInfo(node, cancellationToken);
 }
 //
 // Summary:
 //     Called when the visitor visits a OrderingSyntax node.
 public virtual void VisitOrdering(OrderingSyntax node);
Ejemplo n.º 24
0
 public override SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken))
 {
     var bound = GetBoundQueryClause(node);
     return GetSymbolInfoForQuery(bound);
 }
Ejemplo n.º 25
0
 /// <inheritdoc />
 public override Expression VisitOrdering(OrderingSyntax node)
 {
     throw Unexpected(node, nameof(VisitQueryExpression));
 }
Ejemplo n.º 26
0
 public override SyntaxNode VisitOrdering(OrderingSyntax node)
 {
     node = (OrderingSyntax)base.VisitOrdering(node);
     Classes.Add(node);
     return(node);
 }
Ejemplo n.º 27
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }
Ejemplo n.º 28
0
        public override Evaluation VisitOrdering(OrderingSyntax node)
        {
            node.Expression?.Accept <Evaluation>(this);

            return(base.VisitOrdering(node));
        }
Ejemplo n.º 29
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     throw new NotSupportedException();
 }