private static bool AreEquivalent(StatementSyntax statement1, StatementSyntax statement2)
 {
     return(statement1.Kind() == statement2.Kind() &&
            CSharpFactory.AreEquivalent(statement1, statement2) &&
            statement1.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()) &&
            statement2.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()));
 }
 public static bool AreEquivalent(this StatementSyntax statement, StatementSyntax other)
 {
     return(statement.Kind() == other.Kind() &&
            statement.IsEquivalentTo(other, topLevel: false) &&
            statement.DescendantTrivia().All(x => x.IsWhitespaceOrEndOfLineTrivia()) &&
            other.DescendantTrivia().All(x => x.IsWhitespaceOrEndOfLineTrivia()));
 }
示例#3
0
 private static bool AreEquivalent(StatementSyntax statement, StatementSyntax statement2)
 {
     return(statement.Kind() == statement2.Kind() &&
            statement.IsEquivalentTo(statement2, topLevel: false) &&
            statement.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()) &&
            statement2.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()));
 }
示例#4
0
 private static bool AreEquivalent(StatementSyntax statement, StatementSyntax statement2)
 {
     return(statement.Kind() == statement2.Kind() &&
            SyntaxComparer.AreEquivalent(statement, statement2) &&
            statement.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()) &&
            statement2.DescendantTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()));
 }
示例#5
0
文件: Core.cs 项目: xdrie/SharpNative
        public static void WriteStatementAsBlock(OutputWriter writer, StatementSyntax statement, bool writeBraces = true)
        {
            if (statement is BlockSyntax)
            {
                WriteBlock(writer, statement.As <BlockSyntax>(), writeBraces);
            }
            else
            {
                if (writeBraces)
                {
                    writer.OpenBrace();
                }

                Write(writer, statement);
                TriviaProcessor.ProcessTrivias(writer, statement.DescendantTrivia());

                if (writeBraces)
                {
                    writer.CloseBrace();
                }
            }
        }
示例#6
0
        public static void WriteStatementAsBlock(OutputWriter writer, StatementSyntax statement, bool writeBraces = true)
        {
            if (statement is BlockSyntax)
                WriteBlock(writer, statement.As<BlockSyntax>(), writeBraces);
            else
            {
                if (writeBraces)
                    writer.OpenBrace();

                Write(writer, statement);
                TriviaProcessor.ProcessTrivias(writer, statement.DescendantTrivia());

                if (writeBraces)
                    writer.CloseBrace();
            }
        }