internal void Reset(QueryContinuationSyntax node) { IsAnonymousType = false; IdentifiersChain.Clear(); SourceIdentifier = node.Identifier; IdentifiersChain[SourceIdentifier.ValueText] = 0; }
internal BoundExpression BindQuery(QueryExpressionSyntax node, DiagnosticBag diagnostics) { var fromClause = node.FromClause; var boundFromExpression = BindLeftOfPotentialColorColorMemberAccess(fromClause.Expression, diagnostics); QueryTranslationState state = new QueryTranslationState(); state.fromExpression = MakeMemberAccessValue(boundFromExpression, diagnostics); var x = state.rangeVariable = state.AddRangeVariable(this, fromClause.Identifier, diagnostics); for (int i = node.Body.Clauses.Count - 1; i >= 0; i--) { state.clauses.Push(node.Body.Clauses[i]); } state.selectOrGroup = node.Body.SelectOrGroup; // A from clause that explicitly specifies a range variable type // from T x in e // is translated into // from x in ( e ) . Cast < T > ( ) BoundExpression cast = null; if (fromClause.Type != null) { var typeRestriction = BindTypeArgument(fromClause.Type, diagnostics); cast = MakeQueryInvocation(fromClause, state.fromExpression, "Cast", fromClause.Type, typeRestriction, diagnostics); state.fromExpression = cast; } state.fromExpression = MakeQueryClause(fromClause, state.fromExpression, x, castInvocation: cast); BoundExpression result = BindQueryInternal1(state, diagnostics); for (QueryContinuationSyntax continuation = node.Body.Continuation; continuation != null; continuation = continuation.Body.Continuation) { // A query expression with a continuation // from ... into x ... // is translated into // from x in ( from ... ) ... state.Clear(); state.fromExpression = result; x = state.rangeVariable = state.AddRangeVariable(this, continuation.Identifier, diagnostics); Debug.Assert(state.clauses.IsEmpty()); var clauses = continuation.Body.Clauses; for (int i = clauses.Count - 1; i >= 0; i--) { state.clauses.Push(clauses[i]); } state.selectOrGroup = continuation.Body.SelectOrGroup; result = BindQueryInternal1(state, diagnostics); result = MakeQueryClause(continuation.Body, result, x); result = MakeQueryClause(continuation, result, x); } state.Free(); return(MakeQueryClause(node, result)); }
private Doc PrintQueryContinuationSyntax(QueryContinuationSyntax node) { return(Concat( this.PrintSyntaxToken(node.IntoKeyword, " "), this.PrintSyntaxToken(node.Identifier, Line), this.PrintQueryBodySyntax(node.Body) )); }
public static Doc Print(QueryContinuationSyntax node) { return(Doc.Concat( Token.PrintWithSuffix(node.IntoKeyword, " "), Token.PrintWithSuffix(node.Identifier, Doc.Line), QueryBody.Print(node.Body) )); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { if (_root == default(SyntaxToken) && node.IntoKeyword.ToString().Contains("into")) { _root = node.Identifier; // get the into object SetSearchPatterns(); } base.VisitQueryContinuation(node); }
public override SyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) { if (!_visitQuerySyntax) { return(base.VisitQueryContinuation(node)); } _state.Reset(node); VisitQueryBody(node.Body); return(node); }
public override void AddChildren() { Kind = Node.Kind(); _clauses = ((QueryBodySyntax)Node).Clauses; _clausesIsChanged = false; _clausesCount = _clauses.Count; _selectOrGroup = ((QueryBodySyntax)Node).SelectOrGroup; _selectOrGroupIsChanged = false; _continuation = ((QueryBodySyntax)Node).Continuation; _continuationIsChanged = false; }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { var paramInfo = m_LinqParamInfoStack.Peek(); var paramNames = paramInfo.ParamNames; paramNames.Clear(); paramNames.Add(node.Identifier.Text); CodeBuilder.Append("continuation()"); node.Body.Accept(this); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { var paramInfo = m_LinqParamInfoStack.Peek(); var paramNames = paramInfo.ParamNames; string prestr = paramInfo.Prestr; paramInfo.Prestr = ", "; paramNames.Clear(); paramNames.Add(node.Identifier.Text); CodeBuilder.AppendFormat("{0}{{\"continuation\"}}", prestr); node.Body.Accept(this); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { if (!PreVisit(node)) { return; } node.Body?.Accept(this); base.VisitQueryContinuation(node); PostVisit(node); }
public void VisitQueryContinuation(QueryContinuationSyntax node) { if (node == null) { throw new ArgumentNullException("node"); } node.Validate(); if (node.Identifier != null) { _writer.WriteKeyword(PrinterKeyword.Into); _writer.WriteSpace(); _writer.WriteIdentifier(node.Identifier); _writer.WriteSpace(); } node.Body.Accept(this); }
public override IRangeVariableSymbol GetDeclaredSymbol(QueryContinuationSyntax node, CancellationToken cancellationToken = default(CancellationToken)) { CheckSyntaxNode(node); var model = this.GetMemberModel(node); return (model == null) ? null : model.GetDeclaredSymbol(node, cancellationToken); }
public IRangeVariableSymbol?ToSymbol(QueryContinuationSyntax node) => Model.GetDeclaredSymbol(node, CancellationToken);
public override void VisitQueryContinuation(QueryContinuationSyntax node) { base.VisitQueryContinuation(node); Add(node.Identifier); }
public override LuaSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) { throw new InvalidOperationException(); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { map.Add(node.Identifier.ValueText, node.Identifier); base.VisitQueryContinuation(node); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { throw new NotImplementedException(); }
public override IRangeVariableSymbol GetDeclaredSymbol(QueryContinuationSyntax node, CancellationToken cancellationToken = default(CancellationToken)) { using (Logger.LogBlock(FunctionId.CSharp_SemanticModel_GetDeclaredSymbol, message: this.SyntaxTree.FilePath, cancellationToken: cancellationToken)) { CheckSyntaxNode(node); var model = this.GetMemberModel(node); return (model == null) ? null : model.GetDeclaredSymbol(node, cancellationToken); } }
public override Evaluation VisitQueryContinuation(QueryContinuationSyntax node) { node.Body?.Accept <Evaluation>(this); return(base.VisitQueryContinuation(node)); }
public void VisitQueryContinuation(QueryContinuationSyntax node) { if (node == null) throw new ArgumentNullException("node"); node.Validate(); if (node.Identifier != null) { _writer.WriteKeyword(PrinterKeyword.Into); _writer.WriteSpace(); _writer.WriteIdentifier(node.Identifier); _writer.WriteSpace(); } node.Body.Accept(this); }
public TameQueryContinuationSyntax(QueryContinuationSyntax node) { Node = node; AddChildren(); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { Visit(node.Body); _proceed = true; }
/// <inheritdoc /> public override Expression VisitQueryContinuation(QueryContinuationSyntax node) { throw Unexpected(node, nameof(VisitQueryExpression)); }
internal BoundExpression BindQueryInternal1(QueryExpressionSyntax node, DiagnosticBag diagnostics) { var fromClause = (FromClauseSyntax)node.Clauses[0]; QueryTranslationState state = new QueryTranslationState(); state.fromSyntax = fromClause; state.fromExpression = BindValue(fromClause.Expression, BindValueKind.RValue, diagnostics); state.queryVariable = state.AddQueryVariable(this, fromClause.Identifier); for (int i = node.Clauses.Count - 1; i > 0; i--) { state.clauses.Push(node.Clauses[i]); } state.selectOrGroup = node.SelectOrGroup; // A from clause that explicitly specifies a range variable type // from T x in e // is translated into // from x in ( e ) . Cast < T > ( ) MethodSymbol castMethod = null; if (fromClause.TypeOpt != null) { var typeRestriction = BindType(fromClause.TypeOpt, diagnostics); var cast = MakeInvocation(state.fromSyntax, state.fromExpression, "Cast", fromClause.TypeOpt, typeRestriction, diagnostics); castMethod = cast.Method; state.fromExpression = cast; } state.fromExpression = new BoundQueryClause( syntax: fromClause, syntaxTree: this.SyntaxTree, value: state.fromExpression, definedSymbol: state.queryVariable, queryMethod: null, castMethod: castMethod, type: state.fromExpression.Type); // If the query is a degenerate one the form "from x in e select x", but in source, // then we go ahead and generate the select anyway. We do this by skipping BindQueryInternal2, // whose job it is to (reduce away the whole query and) optimize away degenerate queries. BoundExpression result = (fromClause.TypeOpt == null && IsDegenerateQuery(state)) ? FinalTranslation(state, diagnostics) : BindQueryInternal2(state, diagnostics); QueryContinuationSyntax continuation = node.ContinuationOpt; while (continuation != null) { // A query expression with a continuation // from … into x … // is translated into // from x in ( from … ) … state.Clear(); state.fromExpression = result; var x = state.AddQueryVariable(this, continuation.Identifier); state.fromExpression = new BoundQueryClause( syntax: continuation, syntaxTree: SyntaxTree, value: state.fromExpression, definedSymbol: x, queryMethod: null, castMethod: null, type: state.fromExpression.Type); state.queryVariable = x; Debug.Assert(state.clauses.IsEmpty()); var clauses = continuation.Query.Clauses; for (int i = clauses.Count - 1; i >= 0; i--) { state.clauses.Push(clauses[i]); } state.selectOrGroup = continuation.Query.SelectOrGroup; result = BindQueryInternal2(state, diagnostics); continuation = continuation.Query.ContinuationOpt; } state.Free(); return(result); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { tracker.AddIdentifier(node.Identifier); VisitQueryInternal(null, node.Body); tracker.RemoveIdentifier(node.Identifier); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { this.Found |= node.Identifier.ValueText == this.name; base.VisitQueryContinuation(node); }
private static void HandleContinuation(QueryContinuationSyntax continuation, List<SyntaxToken> tokensToCheck) { tokensToCheck.Add(continuation.IntoKeyword); HandleQueryBody(continuation.Body, tokensToCheck); }
private LuaExpressionSyntax BuildQueryContinuation(LuaExpressionSyntax collection, QueryContinuationSyntax node) { var rangeVariable = AddRangeIdentifier(node.Identifier); return(BuildQueryBody(collection, node.Body, rangeVariable)); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { Log(node, "Unsupported Syntax !"); }
/// <summary> /// Get the query range variable declared in a query continuation clause. /// </summary> public abstract IRangeVariableSymbol GetDeclaredSymbol(QueryContinuationSyntax node, CancellationToken cancellationToken = default(CancellationToken));
/// <summary> /// /// </summary> /// <param name="node"></param> public override sealed void VisitQueryContinuation(QueryContinuationSyntax node) { this.OnNodeVisited(node, this.type.IsInstanceOfType(node)); base.VisitQueryContinuation(node); }
public override IRangeVariableSymbol GetDeclaredSymbol(QueryContinuationSyntax node, CancellationToken cancellationToken = default(CancellationToken)) { var bound = GetBoundQueryClause(node); return bound == null ? null : bound.DefinedSymbol; }
/// <summary> /// /// </summary> /// <param name="node"></param> public override sealed void VisitQueryContinuation(QueryContinuationSyntax node) { this.OnNodeVisited(node); if (!this.traverseRootOnly) base.VisitQueryContinuation(node); }
private static void HandleContinuation(QueryContinuationSyntax continuation, List <SyntaxToken> tokensToCheck) { tokensToCheck.Add(continuation.IntoKeyword); HandleQueryBody(continuation.Body, tokensToCheck); }
public override Ust VisitQueryContinuation(QueryContinuationSyntax node) { return(base.VisitQueryContinuation(node)); }
internal BoundExpression BindQuery(QueryExpressionSyntax node, DiagnosticBag diagnostics) { var fromClause = node.FromClause; var boundFromExpression = BindLeftOfPotentialColorColorMemberAccess(fromClause.Expression, diagnostics); // If the from expression is of the type dynamic we can't infer the types for any lambdas that occur in the query. // Only if there are none we could bind the query but we report an error regardless since such queries are not useful. if (boundFromExpression.HasDynamicType()) { diagnostics.Add(ErrorCode.ERR_BadDynamicQuery, fromClause.Expression.Location); boundFromExpression = BadExpression(fromClause.Expression, boundFromExpression); } QueryTranslationState state = new QueryTranslationState(); state.fromExpression = MakeMemberAccessValue(boundFromExpression, diagnostics); var x = state.rangeVariable = state.AddRangeVariable(this, fromClause.Identifier, diagnostics); for (int i = node.Body.Clauses.Count - 1; i >= 0; i--) { state.clauses.Push(node.Body.Clauses[i]); } state.selectOrGroup = node.Body.SelectOrGroup; // A from clause that explicitly specifies a range variable type // from T x in e // is translated into // from x in ( e ) . Cast < T > ( ) BoundExpression cast = null; if (fromClause.Type != null) { var typeRestriction = BindTypeArgument(fromClause.Type, diagnostics); cast = MakeQueryInvocation(fromClause, state.fromExpression, "Cast", fromClause.Type, typeRestriction, diagnostics); state.fromExpression = cast; } state.fromExpression = MakeQueryClause(fromClause, state.fromExpression, x, castInvocation: cast); BoundExpression result = BindQueryInternal1(state, diagnostics); for (QueryContinuationSyntax continuation = node.Body.Continuation; continuation != null; continuation = continuation.Body.Continuation) { // A query expression with a continuation // from ... into x ... // is translated into // from x in ( from ... ) ... state.Clear(); state.fromExpression = result; x = state.rangeVariable = state.AddRangeVariable(this, continuation.Identifier, diagnostics); Debug.Assert(state.clauses.IsEmpty()); var clauses = continuation.Body.Clauses; for (int i = clauses.Count - 1; i >= 0; i--) { state.clauses.Push(clauses[i]); } state.selectOrGroup = continuation.Body.SelectOrGroup; result = BindQueryInternal1(state, diagnostics); result = MakeQueryClause(continuation.Body, result, x); result = MakeQueryClause(continuation, result, x); } state.Free(); return(MakeQueryClause(node, result)); }
public override void VisitQueryContinuation(QueryContinuationSyntax node) { node.Body?.Accept(this); base.VisitQueryContinuation(node); }