Ejemplo n.º 1
0
        public override SyntaxList <StatementSyntax> VisitAddRemoveHandlerStatement(VBSyntax.AddRemoveHandlerStatementSyntax node)
        {
            var syntaxKind = ConvertAddRemoveHandlerToCSharpSyntaxKind(node);

            return(SingleStatement(SyntaxFactory.AssignmentExpression(syntaxKind,
                                                                      (ExpressionSyntax)node.EventExpression.Accept(_expressionVisitor),
                                                                      (ExpressionSyntax)node.DelegateExpression.Accept(_expressionVisitor))));
        }
Ejemplo n.º 2
0
            private static SyntaxKind ConvertAddRemoveHandlerToCSharpSyntaxKind(VBSyntax.AddRemoveHandlerStatementSyntax node)
            {
                switch (node.Kind())
                {
                case VBasic.SyntaxKind.AddHandlerStatement:
                    return(SyntaxKind.AddAssignmentExpression);

                case VBasic.SyntaxKind.RemoveHandlerStatement:
                    return(SyntaxKind.SubtractAssignmentExpression);

                default:
                    throw new NotImplementedException(node.Kind() + " not implemented!");
                }
            }
Ejemplo n.º 3
0
 public override SyntaxList <StatementSyntax> VisitAddRemoveHandlerStatement(VBSyntax.AddRemoveHandlerStatementSyntax node) => AddLocalVariables(node);
Ejemplo n.º 4
0
            public override SyntaxList <StatementSyntax> VisitAddRemoveHandlerStatement(VBSyntax.AddRemoveHandlerStatementSyntax node)
            {
                var kind  = SyntaxKind.SimpleAssignmentExpression;
                var left  = (ExpressionSyntax)node.EventExpression.Accept(nodesVisitor);
                var right = (ExpressionSyntax)node.DelegateExpression.Accept(nodesVisitor);

                return(SingleStatement(SyntaxFactory.AssignmentExpression(kind, left, right)));
            }
Ejemplo n.º 5
0
            public override SyntaxList <StatementSyntax> VisitAddRemoveHandlerStatement(VBSyntax.AddRemoveHandlerStatementSyntax node)
            {
                var syntaxKind = node.Kind() == VBasic.SyntaxKind.AddHandlerStatement ? SyntaxKind.AddAssignmentExpression : SyntaxKind.SubtractAssignmentExpression;

                return(SingleStatement(SyntaxFactory.AssignmentExpression(syntaxKind,
                                                                          (ExpressionSyntax)node.EventExpression.Accept(nodesVisitor),
                                                                          (ExpressionSyntax)node.DelegateExpression.Accept(nodesVisitor))));
            }