Browse Source

implement query expression AST

pull/254/head
Siegfried Pammer 14 years ago
parent
commit
3526e79db6
  1. 4
      NRefactory/ICSharpCode.NRefactory.VB/Ast/Enums.cs
  2. 42
      NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/CollectionRangeVariableDeclaration.cs
  3. 280
      NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/QueryExpression.cs
  4. 4
      NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/VariableInitializer.cs
  5. 16
      NRefactory/ICSharpCode.NRefactory.VB/IAstVisitor.cs
  6. 1
      NRefactory/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj
  7. 214
      NRefactory/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs
  8. 46
      NRefactory/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs

4
NRefactory/ICSharpCode.NRefactory.VB/Ast/Enums.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -118,7 +118,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
/// <summary>
/// Specifies the ordering direction of a QueryExpressionOrdering node.
/// </summary>
public enum QueryExpressionOrderingDirection
public enum QueryOrderingDirection
{
None,
Ascending,
@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
/// Specifies the partition type for a VB.NET
/// query expression.
/// </summary>
public enum QueryExpressionPartitionType
public enum PartitionKind
{
Take,
TakeWhile,

42
NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/CollectionRangeVariableDeclaration.cs

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.VB.Ast
{
/// <summary>
/// Identifier As Type In Expression
/// </summary>
public class CollectionRangeVariableDeclaration : AstNode
{
public static readonly Role<CollectionRangeVariableDeclaration> CollectionRangeVariableDeclarationRole = new Role<CollectionRangeVariableDeclaration>("CollectionRangeVariableDeclaration");
public VariableIdentifier Identifier {
get { return GetChildByRole(VariableIdentifier.VariableIdentifierRole); }
set { SetChildByRole(VariableIdentifier.VariableIdentifierRole, value); }
}
public AstType Type {
get { return GetChildByRole(Roles.Type); }
set { SetChildByRole(Roles.Type, value); }
}
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCollectionRangeVariableDeclaration(this, data);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
CollectionRangeVariableDeclaration o = other as CollectionRangeVariableDeclaration;
return o != null && this.Identifier.DoMatch(o.Identifier, match) && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match);
}
}
}

280
NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/QueryExpression.cs

@ -53,7 +53,240 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -53,7 +53,240 @@ namespace ICSharpCode.NRefactory.VB.Ast
public class FromQueryOperator : QueryOperator
{
public AstNodeCollection<CollectionRangeVariableDeclaration> Variables {
get { return GetChildrenByRole (CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitFromQueryOperator(this, data);
}
}
public class AggregateQueryOperator : QueryOperator
{
public CollectionRangeVariableDeclaration Variable {
get { return GetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
set { SetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole, value); }
}
public AstNodeCollection<QueryOperator> SubQueryOperators {
get { return GetChildrenByRole(QueryOperatorRole); }
}
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAggregateQueryOperator(this, data);
}
}
public class SelectQueryOperator : QueryOperator
{
public AstNodeCollection<VariableInitializer> Variables {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSelectQueryOperator(this, data);
}
}
public class DistinctQueryOperator : QueryOperator
{
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDistinctQueryOperator(this, data);
}
}
public class WhereQueryOperator : QueryOperator
{
public Expression Condition {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitWhereQueryOperator(this, data);
}
}
public class OrderExpression : AstNode
{
public static readonly Role<OrderExpression> OrderExpressionRole = new Role<OrderExpression>("OrderExpression");
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
public QueryOrderingDirection Direction { get; set; }
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitOrderExpression(this, data);
}
}
public class OrderByQueryOperator : QueryOperator
{
public AstNodeCollection<OrderExpression> Expressions {
get { return GetChildrenByRole(OrderExpression.OrderExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitOrderByQueryOperator(this, data);
}
}
public class PartitionQueryOperator : QueryOperator
{
public PartitionKind Kind { get; set; }
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPartitionQueryOperator(this, data);
}
}
public class LetQueryOperator : QueryOperator
{
public AstNodeCollection<VariableInitializer> Variables {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitLetQueryOperator(this, data);
}
}
public class GroupByQueryOperator : QueryOperator
{
public static readonly Role<VariableInitializer> GroupExpressionRole = new Role<VariableInitializer>("GroupExpression");
public static readonly Role<VariableInitializer> ByExpressionRole = new Role<VariableInitializer>("ByExpression");
public static readonly Role<VariableInitializer> IntoExpressionRole = new Role<VariableInitializer>("IntoExpression");
public AstNodeCollection<VariableInitializer> GroupExpressions {
get { return GetChildrenByRole(GroupExpressionRole); }
}
public AstNodeCollection<VariableInitializer> ByExpressions {
get { return GetChildrenByRole(ByExpressionRole); }
}
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(IntoExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGroupByQueryOperator(this, data);
}
}
public class JoinQueryOperator : QueryOperator
{
#region Null
public new static readonly JoinQueryOperator Null = new NullJoinQueryOperator();
sealed class NullJoinQueryOperator : JoinQueryOperator
{
public override bool IsNull {
get {
return true;
}
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
return other == null || other.IsNull;
}
}
#endregion
public static readonly Role<JoinQueryOperator> JoinQueryOperatorRole = new Role<JoinQueryOperator>("JoinQueryOperator", JoinQueryOperator.Null);
public CollectionRangeVariableDeclaration JoinVariable {
get { return GetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
set { SetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole, value); }
}
public JoinQueryOperator SubJoinQuery {
get { return GetChildByRole(JoinQueryOperatorRole); }
set { SetChildByRole(JoinQueryOperatorRole, value); }
}
public AstNodeCollection<JoinCondition> JoinConditions {
get { return GetChildrenByRole(JoinCondition.JoinConditionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
@ -61,8 +294,55 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -61,8 +294,55 @@ namespace ICSharpCode.NRefactory.VB.Ast
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitJoinQueryOperator(this, data);
}
}
public class JoinCondition : AstNode
{
public static readonly Role<JoinCondition> JoinConditionRole = new Role<JoinCondition>("JoinCondition");
public static readonly Role<Expression> LeftExpressionRole = BinaryOperatorExpression.LeftExpressionRole;
public static readonly Role<Expression> RightExpressionRole = BinaryOperatorExpression.RightExpressionRole;
public Expression Left {
get { return GetChildByRole (LeftExpressionRole); }
set { SetChildByRole (LeftExpressionRole, value); }
}
public Expression Right {
get { return GetChildByRole (RightExpressionRole); }
set { SetChildByRole (RightExpressionRole, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitJoinCondition(this, data);
}
}
public class GroupJoinQueryOperator : JoinQueryOperator
{
public static readonly Role<VariableInitializer> IntoExpressionRole = GroupByQueryOperator.IntoExpressionRole;
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(IntoExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGroupJoinQueryOperator(this, data);
}
}
}

4
NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/VariableInitializer.cs

@ -11,6 +11,8 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -11,6 +11,8 @@ namespace ICSharpCode.NRefactory.VB.Ast
/// </summary>
public class VariableInitializer : AstNode
{
public static readonly Role<VariableInitializer> VariableInitializerRole = new Role<VariableInitializer>("VariableInitializer");
public VariableIdentifier Identifier {
get { return GetChildByRole(VariableIdentifier.VariableIdentifierRole); }
set { SetChildByRole(VariableIdentifier.VariableIdentifierRole, value); }
@ -38,7 +40,7 @@ namespace ICSharpCode.NRefactory.VB.Ast @@ -38,7 +40,7 @@ namespace ICSharpCode.NRefactory.VB.Ast
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
VariableInitializer o = other as VariableInitializer;
return o != null && this.Identifier.DoMatch(o.Identifier, match) && this.Expression.DoMatch(o.Expression, match);
return o != null && this.Identifier.DoMatch(o.Identifier, match) && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match);
}
}
}

16
NRefactory/ICSharpCode.NRefactory.VB/IAstVisitor.cs

@ -115,5 +115,21 @@ namespace ICSharpCode.NRefactory.VB { @@ -115,5 +115,21 @@ namespace ICSharpCode.NRefactory.VB {
S VisitEmptyExpression(EmptyExpression emptyExpression, T data);
S VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpression anonymousObjectCreationExpression, T data);
S VisitCollectionRangeVariableDeclaration(CollectionRangeVariableDeclaration collectionRangeVariableDeclaration, T data);
S VisitFromQueryOperator(FromQueryOperator fromQueryOperator, T data);
S VisitAggregateQueryOperator(AggregateQueryOperator aggregateQueryOperator, T data);
S VisitSelectQueryOperator(SelectQueryOperator selectQueryOperator, T data);
S VisitDistinctQueryOperator(DistinctQueryOperator distinctQueryOperator, T data);
S VisitWhereQueryOperator(WhereQueryOperator whereQueryOperator, T data);
S VisitOrderExpression(OrderExpression orderExpression, T data);
S VisitOrderByQueryOperator(OrderByQueryOperator orderByQueryOperator, T data);
S VisitPartitionQueryOperator(PartitionQueryOperator partitionQueryOperator, T data);
S VisitLetQueryOperator(LetQueryOperator letQueryOperator, T data);
S VisitGroupByQueryOperator(GroupByQueryOperator groupByQueryOperator, T data);
S VisitJoinQueryOperator(JoinQueryOperator joinQueryOperator, T data);
S VisitJoinCondition(JoinCondition joinCondition, T data);
S VisitGroupJoinQueryOperator(GroupJoinQueryOperator groupJoinQueryOperator, T data);
}
}

1
NRefactory/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj

@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
<Compile Include="Ast\Expressions\AssignmentExpression.cs" />
<Compile Include="Ast\Expressions\BinaryOperatorExpression.cs" />
<Compile Include="Ast\Expressions\CastExpression.cs" />
<Compile Include="Ast\Expressions\CollectionRangeVariableDeclaration.cs" />
<Compile Include="Ast\Expressions\ConditionalExpression.cs" />
<Compile Include="Ast\Expressions\EmptyExpression.cs" />
<Compile Include="Ast\Expressions\Expression.cs" />

214
NRefactory/ICSharpCode.NRefactory.VB/OutputVisitor/OutputVisitor.cs

@ -2427,5 +2427,219 @@ namespace ICSharpCode.NRefactory.VB @@ -2427,5 +2427,219 @@ namespace ICSharpCode.NRefactory.VB
return EndNode(anonymousObjectCreationExpression);
}
public object VisitCollectionRangeVariableDeclaration(CollectionRangeVariableDeclaration collectionRangeVariableDeclaration, object data)
{
StartNode(collectionRangeVariableDeclaration);
collectionRangeVariableDeclaration.Identifier.AcceptVisitor(this, data);
if (!collectionRangeVariableDeclaration.Type.IsNull) {
WriteKeyword("As");
collectionRangeVariableDeclaration.Type.AcceptVisitor(this, data);
}
WriteKeyword("In");
collectionRangeVariableDeclaration.Expression.AcceptVisitor(this, data);
return EndNode(collectionRangeVariableDeclaration);
}
public object VisitFromQueryOperator(FromQueryOperator fromQueryOperator, object data)
{
StartNode(fromQueryOperator);
WriteKeyword("From");
WriteCommaSeparatedList(fromQueryOperator.Variables);
return EndNode(fromQueryOperator);
}
public object VisitAggregateQueryOperator(AggregateQueryOperator aggregateQueryOperator, object data)
{
StartNode(aggregateQueryOperator);
WriteKeyword("Aggregate");
aggregateQueryOperator.Variable.AcceptVisitor(this, data);
foreach (var operators in aggregateQueryOperator.SubQueryOperators) {
operators.AcceptVisitor(this, data);
}
WriteKeyword("Into");
WriteCommaSeparatedList(aggregateQueryOperator.IntoExpressions);
return EndNode(aggregateQueryOperator);
}
public object VisitSelectQueryOperator(SelectQueryOperator selectQueryOperator, object data)
{
StartNode(selectQueryOperator);
WriteKeyword("Select");
WriteCommaSeparatedList(selectQueryOperator.Variables);
return EndNode(selectQueryOperator);
}
public object VisitDistinctQueryOperator(DistinctQueryOperator distinctQueryOperator, object data)
{
StartNode(distinctQueryOperator);
WriteKeyword("Distinct");
return EndNode(distinctQueryOperator);
}
public object VisitWhereQueryOperator(WhereQueryOperator whereQueryOperator, object data)
{
StartNode(whereQueryOperator);
WriteKeyword("Where");
whereQueryOperator.Condition.AcceptVisitor(this, data);
return EndNode(whereQueryOperator);
}
public object VisitPartitionQueryOperator(PartitionQueryOperator partitionQueryOperator, object data)
{
StartNode(partitionQueryOperator);
switch (partitionQueryOperator.Kind) {
case PartitionKind.Take:
WriteKeyword("Take");
break;
case PartitionKind.TakeWhile:
WriteKeyword("Take");
WriteKeyword("While");
break;
case PartitionKind.Skip:
WriteKeyword("Skip");
break;
case PartitionKind.SkipWhile:
WriteKeyword("Skip");
WriteKeyword("While");
break;
default:
throw new Exception("Invalid value for PartitionKind");
}
partitionQueryOperator.Expression.AcceptVisitor(this, data);
return EndNode(partitionQueryOperator);
}
public object VisitOrderExpression(OrderExpression orderExpression, object data)
{
StartNode(orderExpression);
orderExpression.Expression.AcceptVisitor(this, data);
switch (orderExpression.Direction) {
case QueryOrderingDirection.None:
break;
case QueryOrderingDirection.Ascending:
WriteKeyword("Ascending");
break;
case QueryOrderingDirection.Descending:
WriteKeyword("Descending");
break;
default:
throw new Exception("Invalid value for QueryExpressionOrderingDirection");
}
return EndNode(orderExpression);
}
public object VisitOrderByQueryOperator(OrderByQueryOperator orderByQueryOperator, object data)
{
StartNode(orderByQueryOperator);
WriteKeyword("Order");
WriteKeyword("By");
WriteCommaSeparatedList(orderByQueryOperator.Expressions);
return EndNode(orderByQueryOperator);
}
public object VisitLetQueryOperator(LetQueryOperator letQueryOperator, object data)
{
StartNode(letQueryOperator);
WriteKeyword("Let");
WriteCommaSeparatedList(letQueryOperator.Variables);
return EndNode(letQueryOperator);
}
public object VisitGroupByQueryOperator(GroupByQueryOperator groupByQueryOperator, object data)
{
StartNode(groupByQueryOperator);
WriteKeyword("Group");
WriteCommaSeparatedList(groupByQueryOperator.GroupExpressions);
WriteKeyword("By");
WriteCommaSeparatedList(groupByQueryOperator.ByExpressions);
WriteKeyword("Into");
WriteCommaSeparatedList(groupByQueryOperator.IntoExpressions);
return EndNode(groupByQueryOperator);
}
public object VisitJoinQueryOperator(JoinQueryOperator joinQueryOperator, object data)
{
StartNode(joinQueryOperator);
WriteKeyword("Join");
joinQueryOperator.JoinVariable.AcceptVisitor(this, data);
if (!joinQueryOperator.SubJoinQuery.IsNull) {
joinQueryOperator.SubJoinQuery.AcceptVisitor(this, data);
}
WriteKeyword("On");
bool first = true;
foreach (var cond in joinQueryOperator.JoinConditions) {
if (first)
first = false;
else
WriteKeyword("And");
cond.AcceptVisitor(this, data);
}
return EndNode(joinQueryOperator);
}
public object VisitJoinCondition(JoinCondition joinCondition, object data)
{
StartNode(joinCondition);
joinCondition.Left.AcceptVisitor(this, data);
WriteKeyword("Equals");
joinCondition.Right.AcceptVisitor(this, data);
return EndNode(joinCondition);
}
public object VisitGroupJoinQueryOperator(GroupJoinQueryOperator groupJoinQueryOperator, object data)
{
StartNode(groupJoinQueryOperator);
WriteKeyword("Group");
WriteKeyword("Join");
groupJoinQueryOperator.JoinVariable.AcceptVisitor(this, data);
if (!groupJoinQueryOperator.SubJoinQuery.IsNull) {
groupJoinQueryOperator.SubJoinQuery.AcceptVisitor(this, data);
}
WriteKeyword("On");
bool first = true;
foreach (var cond in groupJoinQueryOperator.JoinConditions) {
if (first)
first = false;
else
WriteKeyword("And");
cond.AcceptVisitor(this, data);
}
WriteKeyword("Into");
WriteCommaSeparatedList(groupJoinQueryOperator.IntoExpressions);
return EndNode(groupJoinQueryOperator);
}
}
}

46
NRefactory/ICSharpCode.NRefactory.VB/Visitors/CSharpToVBConverterVisitor.cs

@ -235,6 +235,12 @@ namespace ICSharpCode.NRefactory.VB.Visitors @@ -235,6 +235,12 @@ namespace ICSharpCode.NRefactory.VB.Visitors
case ICSharpCode.NRefactory.CSharp.BinaryOperatorType.ShiftRight:
op = BinaryOperatorType.ShiftRight;
break;
case ICSharpCode.NRefactory.CSharp.BinaryOperatorType.NullCoalescing:
var nullCoalescing = new ConditionalExpression {
ConditionExpression = left,
FalseExpression = right
};
return EndNode(binaryOperatorExpression, nullCoalescing);
default:
throw new Exception("Invalid value for BinaryOperatorType: " + binaryOperatorExpression.Operator);
}
@ -635,7 +641,16 @@ namespace ICSharpCode.NRefactory.VB.Visitors @@ -635,7 +641,16 @@ namespace ICSharpCode.NRefactory.VB.Visitors
public AstNode VisitQueryFromClause(CSharp.QueryFromClause queryFromClause, object data)
{
throw new NotImplementedException();
var op = new FromQueryOperator();
op.Variables.Add(
new CollectionRangeVariableDeclaration {
Identifier = new VariableIdentifier { Name = queryFromClause.Identifier },
Type = (AstType)queryFromClause.Type.AcceptVisitor(this, data),
Expression = (Expression)queryFromClause.Expression.AcceptVisitor(this, data)
}
);
return EndNode(queryFromClause, op);
}
public AstNode VisitQueryLetClause(CSharp.QueryLetClause queryLetClause, object data)
@ -655,22 +670,45 @@ namespace ICSharpCode.NRefactory.VB.Visitors @@ -655,22 +670,45 @@ namespace ICSharpCode.NRefactory.VB.Visitors
public AstNode VisitQueryOrderClause(CSharp.QueryOrderClause queryOrderClause, object data)
{
throw new NotImplementedException();
var op = new OrderByQueryOperator();
ConvertNodes(queryOrderClause.Orderings, op.Expressions);
return EndNode(queryOrderClause, op);
}
public AstNode VisitQueryOrdering(CSharp.QueryOrdering queryOrdering, object data)
{
throw new NotImplementedException();
var expr = new OrderExpression();
expr.Direction = (QueryOrderingDirection)queryOrdering.Direction;
expr.Expression = (Expression)queryOrdering.Expression.AcceptVisitor(this, data);
return EndNode(queryOrdering, expr);
}
int selectVarCount = 0;
public AstNode VisitQuerySelectClause(CSharp.QuerySelectClause querySelectClause, object data)
{
throw new NotImplementedException();
var op = new SelectQueryOperator();
op.Variables.Add(
new VariableInitializer {
Identifier = new VariableIdentifier { Name = "SelectVar" + selectVarCount },
Expression = (Expression)querySelectClause.Expression.AcceptVisitor(this, data)
});
return EndNode(querySelectClause, op);
}
public AstNode VisitQueryGroupClause(CSharp.QueryGroupClause queryGroupClause, object data)
{
var op = new GroupByQueryOperator();
throw new NotImplementedException();
return EndNode(queryGroupClause, op);
}
public AstNode VisitAttribute(CSharp.Attribute attribute, object data)

Loading…
Cancel
Save