Skip to content

Comments

Skip redundant line-number comments on empty lines#237

Merged
pigpigyyy merged 1 commit intomainfrom
codex/remove-line-number-comments-from-empty-lines
Feb 21, 2026
Merged

Skip redundant line-number comments on empty lines#237
pigpigyyy merged 1 commit intomainfrom
codex/remove-line-number-comments-from-empty-lines

Conversation

@pigpigyyy
Copy link
Member

Motivation

  • The compiler emitted standalone trailing line-number comments (e.g. -- 123) for EmptyLine_t nodes inside tablelit, tableblock and classblock when reserve_line_number/-l was enabled, producing redundant comment-only lines in generated output.

Description

  • Update nl(ast_node* node) in src/yuescript/yue_compiler.cpp to return only the newline for EmptyLine_t nodes when _config.reserveLineNumber is true, avoiding the -- <line> suffix for blank lines.
  • Add a regression CLI test in spec/cli/test_compilation.sh that compiles a file containing empty lines inside table/class blocks and asserts no standalone -- <number> lines are present.
  • Modified files: src/yuescript/yue_compiler.cpp and spec/cli/test_compilation.sh.

Testing

  • Built the project with make -j4 and the build completed successfully.
  • Ran the CLI tests with YUE_BIN=./yue spec/cli/test_compilation.sh and all tests passed (21/21), including the new regression asserting empty lines do not produce standalone line-number comment lines.

Codex Task

@pigpigyyy pigpigyyy merged commit 28253ef into main Feb 21, 2026
3 checks passed
@pigpigyyy pigpigyyy deleted the codex/remove-line-number-comments-from-empty-lines branch February 21, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant