Пример #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);
 }
Пример #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");
        }
Пример #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);
        }
        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);
            }
        }
Пример #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);
        }
Пример #7
0
        public override void VisitOrdering(OrderingSyntax node)
        {
            node.Expression?.Accept(this);

            base.VisitOrdering(node);
        }
Пример #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;
            }
Пример #10
0
 public override void VisitOrdering(OrderingSyntax queryOrdering)
 {
     base.VisitOrdering(queryOrdering);
     _indexData.HasOrder = true;
 }
Пример #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;
        }
Пример #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));
Пример #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);
     }
 }
Пример #14
0
 public TameOrderingSyntax(OrderingSyntax node)
 {
     Node = node;
     AddChildren();
 }
Пример #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);
            }
        }
Пример #16
0
 public override void VisitOrdering(OrderingSyntax node)
 {
 }
Пример #17
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     base.VisitOrdering(node);
 }
Пример #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));
        }
Пример #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);
 }
Пример #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);
Пример #24
0
 public override SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken))
 {
     var bound = GetBoundQueryClause(node);
     return GetSymbolInfoForQuery(bound);
 }
Пример #25
0
 /// <inheritdoc />
 public override Expression VisitOrdering(OrderingSyntax node)
 {
     throw Unexpected(node, nameof(VisitQueryExpression));
 }
Пример #26
0
 public override SyntaxNode VisitOrdering(OrderingSyntax node)
 {
     node = (OrderingSyntax)base.VisitOrdering(node);
     Classes.Add(node);
     return(node);
 }
Пример #27
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }
Пример #28
0
        public override Evaluation VisitOrdering(OrderingSyntax node)
        {
            node.Expression?.Accept <Evaluation>(this);

            return(base.VisitOrdering(node));
        }
Пример #29
0
 public override void VisitOrdering(OrderingSyntax node)
 {
     throw new NotSupportedException();
 }