fix(codegen): clear print_next_indent_as_space after newlines#17884
Closed
s7tya wants to merge 1 commit intooxc-project:mainfrom
Closed
fix(codegen): clear print_next_indent_as_space after newlines#17884s7tya wants to merge 1 commit intooxc-project:mainfrom
print_next_indent_as_space after newlines#17884s7tya wants to merge 1 commit intooxc-project:mainfrom
Conversation
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Contributor
042f0f6 to
da113bb
Compare
Boshen
reviewed
Jan 12, 2026
Member
Boshen
left a comment
There was a problem hiding this comment.
The fix doesn't look right, let me double check.
Boshen
added a commit
that referenced
this pull request
Jan 14, 2026
…comments Clear the `print_next_indent_as_space` flag after printing comments in `ExportSpecifier` to prevent it from leaking to subsequent statements. When a block comment like `/* comment */` is printed inside an export specifier, the flag is set expecting `print_indent()` to consume it. However, `ExportSpecifier` calls `print_soft_space()` instead, leaving the flag set. This caused the next export statement to incorrectly print a leading space. Closes #17884 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
print_comments()can setprint_next_indent_as_spaceafter inline comments to request a single space before the next token. If a newline is emitted before the flag is consumed, the flag may leak across line boundaries and get consumed at the start of the next statement, producing stray leading spaces.This PR clears
print_next_indent_as_spacewhenever a newline is emitted (print_soft_newline/print_hard_newline) and routesprint_semicolon_after_statement()throughprint_hard_newline()so newline handling consistently resets the flag.