예제 #1
0
        private BoundStatement RewriteSequencePointStatement(BoundSequencePointStatement node)
        {
            var statement = RewriteStatement(node.Statement);

            if (statement == node.Statement)
            {
                return(node);
            }

            return(new BoundSequencePointStatement(node.Syntax, statement, node.Location));
        }
예제 #2
0
        private static void WriteSequencePointStatement(BoundSequencePointStatement node, IndentedTextWriter writer)
        {
            var sourceText = node.Location.Text;
            var span       = node.Location.Span;

            var startLine = sourceText.GetLineIndex(span.Start);
            var endLine   = sourceText.GetLineIndex(span.End - 1);

            for (var i = startLine; i <= endLine; i++)
            {
                var line     = sourceText.Lines[i];
                var start    = Math.Max(line.Start, span.Start);
                var end      = Math.Min(line.End, span.End);
                var lineSpan = TextSpan.FromBounds(start, end);

                var text = sourceText.ToString(lineSpan);
                writer.WriteComment(text);
                writer.WriteLine();
            }

            node.Statement.WriteTo(writer);
        }