Exemplo n.º 1
0
        private bool TryConvertRaiseEvent(CSS.StatementSyntax resultStatement,
                                          CSS.BinaryExpressionSyntax be, ref StatementSyntax raiseEventStatement)
        {
            CSS.ExpressionStatementSyntax singleStatement;
            if (resultStatement is CSS.BlockSyntax block)
            {
                if (block.Statements.Count != 1)
                {
                    return(false);
                }
                singleStatement = block.Statements[0] as CSS.ExpressionStatementSyntax;
            }
            else
            {
                singleStatement = resultStatement as CSS.ExpressionStatementSyntax;
            }

            if (!(singleStatement?.Expression is CSS.InvocationExpressionSyntax singleInvocationExpression))
            {
                return(false);
            }

            raiseEventStatement = singleInvocationExpression.Accept(_nodesVisitor) as RaiseEventStatementSyntax;
            return(raiseEventStatement != null);
        }
Exemplo n.º 2
0
 private static bool TryGetBinaryExpression(CSS.IfStatementSyntax node, out CSS.BinaryExpressionSyntax binaryExpressionSyntax, CS.SyntaxKind notEqualsExpression, CS.SyntaxKind operand)
 {
     binaryExpressionSyntax = TrimParenthesis(node) as CSS.BinaryExpressionSyntax;
     return(binaryExpressionSyntax != null &&
            binaryExpressionSyntax.IsKind(notEqualsExpression) &&
            (binaryExpressionSyntax.Left.IsKind(operand) ||
             binaryExpressionSyntax.Right.IsKind(operand)));
 }
Exemplo n.º 3
0
 public static glsl.BinaryExpressionSyntax Translate(this cs.BinaryExpressionSyntax node)
 {
     return(new glsl.BinaryExpressionSyntax().Update(
                node.Left.Translate(),
                node.OperatorToken,
                node.Right.Translate()
                ));
 }
            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)
                           ));
            }