public override VisualBasicSyntaxNode VisitAssignmentExpression(CSS.AssignmentExpressionSyntax node) { var kind = ConvertToken(CS.CSharpExtensions.Kind(node), TokenContext.Local); if (node.Parent is CSS.ExpressionStatementSyntax) { return(SyntaxFactory.AssignmentStatement( kind, (ExpressionSyntax)node.Left.Accept(this), SyntaxFactory.Token(VBUtil.GetBinaryExpressionOperatorTokenKind(kind)), (ExpressionSyntax)node.Right.Accept(this) )); } else { MarkPatchInlineAssignHelper(node); return(SyntaxFactory.InvocationExpression( SyntaxFactory.IdentifierName("__InlineAssignHelper"), SyntaxFactory.ArgumentList( SyntaxFactory.SeparatedList( new ArgumentSyntax[] { SyntaxFactory.SimpleArgument((ExpressionSyntax)node.Left.Accept(this)), SyntaxFactory.SimpleArgument((ExpressionSyntax)node.Right.Accept(this)) } ) ) )); } }
public override VisualBasicSyntaxNode VisitBinaryExpression(CSS.BinaryExpressionSyntax node) { var kind = ConvertToken(CS.CSharpExtensions.Kind(node), TokenContext.Local); return(SyntaxFactory.BinaryExpression( kind, (ExpressionSyntax)node.Left.Accept(this), SyntaxFactory.Token(VBUtil.GetBinaryExpressionOperatorTokenKind(kind)), (ExpressionSyntax)node.Right.Accept(this) )); }
public override VisualBasicSyntaxNode VisitPostfixUnaryExpression(CSS.PostfixUnaryExpressionSyntax node) { var kind = ConvertToken(CS.CSharpExtensions.Kind(node), TokenContext.Local); if (node.Parent is CSS.ExpressionStatementSyntax) { return(SyntaxFactory.AssignmentStatement( ConvertToken(CS.CSharpExtensions.Kind(node), TokenContext.Local), (ExpressionSyntax)node.Operand.Accept(this), SyntaxFactory.Token(VBUtil.GetBinaryExpressionOperatorTokenKind(kind)), Literal(1) )); } else { string operatorName, minMax; SyntaxKind op; if (kind == SyntaxKind.AddAssignmentStatement) { operatorName = "Increment"; minMax = "Min"; op = SyntaxKind.SubtractExpression; } else { operatorName = "Decrement"; minMax = "Max"; op = SyntaxKind.AddExpression; } return(SyntaxFactory.InvocationExpression( SyntaxFactory.ParseName("Math." + minMax), SyntaxFactory.ArgumentList( SyntaxFactory.SeparatedList( new ArgumentSyntax[] { SyntaxFactory.SimpleArgument( SyntaxFactory.InvocationExpression( SyntaxFactory.ParseName("System.Threading.Interlocked." + operatorName), SyntaxFactory.ArgumentList( SyntaxFactory.SingletonSeparatedList <ArgumentSyntax>( SyntaxFactory.SimpleArgument((ExpressionSyntax)node.Operand.Accept(this)) ) ) ) ), SyntaxFactory.SimpleArgument(SyntaxFactory.BinaryExpression(op, (ExpressionSyntax)node.Operand.Accept(this), SyntaxFactory.Token(VBUtil.GetBinaryExpressionOperatorTokenKind(op)), Literal(1))) } ) ) )); } }