@@ -2400,7 +2400,54 @@ public override object TrackedVisitInvocationExpression(InvocationExpression inv
24002400 outputFormatter . PrintToken ( Tokens . CloseParenthesis ) ;
24012401 return null ;
24022402 }
2403-
2403+
2404+ public override object TrackedVisitXmlMemberAccessExpression ( XmlMemberAccessExpression xmlMemberAccessExpression , object data )
2405+ {
2406+ var parentAsAssignment = xmlMemberAccessExpression . Parent as AssignmentExpression ;
2407+ var xmlMemberAccessExpressionOnLeftOfAssignment = parentAsAssignment != null && parentAsAssignment . Left == xmlMemberAccessExpression ;
2408+
2409+ // only output identifier expression if we are not overriding assignment with method call
2410+ if ( ! ( xmlMemberAccessExpression . AxisType == XmlAxisType . Attribute && xmlMemberAccessExpressionOnLeftOfAssignment ) )
2411+ xmlMemberAccessExpression . TargetObject . AcceptVisitor ( this , data ) ;
2412+
2413+ switch ( xmlMemberAccessExpression . AxisType )
2414+ {
2415+ case XmlAxisType . Element :
2416+ outputFormatter . PrintToken ( Tokens . Dot ) ;
2417+ outputFormatter . PrintText ( "Elements(\" " ) ;
2418+ outputFormatter . PrintText ( xmlMemberAccessExpression . Identifier ) ;
2419+ outputFormatter . PrintText ( "\" )" ) ;
2420+ break ;
2421+ case XmlAxisType . Attribute :
2422+ if ( ! xmlMemberAccessExpressionOnLeftOfAssignment )
2423+ {
2424+ outputFormatter . PrintToken ( Tokens . Dot ) ;
2425+ outputFormatter . PrintText ( "Attribute(\" " ) ;
2426+ outputFormatter . PrintText ( xmlMemberAccessExpression . Identifier ) ;
2427+ outputFormatter . PrintText ( "\" ).Value" ) ;
2428+ }
2429+ else
2430+ {
2431+ // we need to convert assignment to method call
2432+ return AstBuilder . ExpressionBuilder . Call (
2433+ xmlMemberAccessExpression . TargetObject ,
2434+ "SetAttributeValue" ,
2435+ new PrimitiveExpression ( xmlMemberAccessExpression . Identifier ) ,
2436+ parentAsAssignment . Right ) ;
2437+ }
2438+ break ;
2439+ case XmlAxisType . Descendents :
2440+ outputFormatter . PrintToken ( Tokens . Dot ) ;
2441+ outputFormatter . PrintText ( "Descendants(\" " ) ;
2442+ outputFormatter . PrintText ( xmlMemberAccessExpression . Identifier ) ;
2443+ outputFormatter . PrintText ( "\" )" ) ;
2444+ break ;
2445+ default :
2446+ throw new Exception ( "Invalid value for XmlAxisType" ) ;
2447+ }
2448+ return null ;
2449+ }
2450+
24042451 public override object TrackedVisitIdentifierExpression ( IdentifierExpression identifierExpression , object data )
24052452 {
24062453 outputFormatter . PrintIdentifier ( identifierExpression . Identifier ) ;
@@ -2472,7 +2519,12 @@ public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpressi
24722519
24732520 public override object TrackedVisitAssignmentExpression ( AssignmentExpression assignmentExpression , object data )
24742521 {
2475- TrackVisit ( assignmentExpression . Left , data ) ;
2522+ var overrideExpression = TrackVisit ( assignmentExpression . Left , data ) as InvocationExpression ;
2523+ if ( overrideExpression != null )
2524+ {
2525+ TrackVisit ( overrideExpression , data ) ;
2526+ return null ;
2527+ }
24762528 if ( this . prettyPrintOptions . AroundAssignmentParentheses ) {
24772529 outputFormatter . Space ( ) ;
24782530 }
@@ -3187,9 +3239,22 @@ public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSe
31873239 outputFormatter . Space ( ) ;
31883240 return selectClause . Projection . AcceptVisitor ( this , data ) ;
31893241 }
3190-
3191- public override object TrackedVisitQueryExpressionWhereClause ( QueryExpressionWhereClause whereClause , object data )
3242+
3243+ public override object TrackedVisitQueryExpressionSelectVBClause ( QueryExpressionSelectVBClause queryExpressionSelectVBClause , object data )
3244+ {
3245+ outputFormatter . Space ( ) ;
3246+ outputFormatter . PrintToken ( Tokens . Select ) ;
3247+ outputFormatter . Space ( ) ;
3248+ foreach ( var v in queryExpressionSelectVBClause . Variables )
3249+ {
3250+ v . AcceptVisitor ( this , data ) ;
3251+ }
3252+ return null ;
3253+ }
3254+
3255+ public override object TrackedVisitQueryExpressionWhereClause ( QueryExpressionWhereClause whereClause , object data )
31923256 {
3257+ outputFormatter . Space ( ) ;
31933258 outputFormatter . PrintToken ( Tokens . Where ) ;
31943259 outputFormatter . Space ( ) ;
31953260 return whereClause . Condition . AcceptVisitor ( this , data ) ;
0 commit comments