protected void FlushPendingEOLComments(bool isEndOfLine) { if (!_flushingEOLComments) // Prevent re-entry { // Preserve 'NeedsNewLine' state and clear it during this operation bool needsNewLine = NeedsNewLine; NeedsNewLine = false; _flushingEOLComments = true; foreach (EOLComment eolComment in _pendingEOLComments) { // If the comment is the first thing on the line, we have to restore the original indentation // offset temporarily before rendering it. Comment comment = eolComment.Comment; if (comment.IsFirstOnLine) { BeginOutdentOnNewLine(comment, eolComment.Indentation); } comment.AsText(this, eolComment.RenderFlags | (isEndOfLine ? 0 : CodeObject.RenderFlags.CommentsInline)); if (comment.IsFirstOnLine) { EndIndentation(comment); needsNewLine = false; // Force off if we emitted a newline } } _pendingEOLComments.Clear(); _flushingEOLComments = false; NeedsNewLine = needsNewLine; } }