Parser: attach comments to ClassDefinition, MethodDefinition, StateDeclaration (BT-975)#1011
Parser: attach comments to ClassDefinition, MethodDefinition, StateDeclaration (BT-975)#1011
Conversation
…aration BT-975 Implements `collect_comment_attachment()` in the parser that collects `//` and `/* */` trivia into `CommentAttachment.leading`, skipping `///` doc comments (handled by `collect_doc_comment()`). Wires both helpers at all three parse sites: - `parse_class_definition()`: doc_comment + comments - `parse_method_definition()`: doc_comment + comments - `parse_state_declaration()` / `parse_classvar_declaration()`: doc_comment + comments Ordering: `collect_doc_comment()` runs first (both are immutable reads of the same leading trivia), then `collect_comment_attachment()` skips DocComment variants to prevent duplication. Updates 20 parser snapshots to reflect the new `comments` field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
⛔ Files ignored due to path filters (20)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds support for attaching regular comments to AST nodes by introducing a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Summary
Implements Phase 2, Issue 3 of ADR 0044 (Comments as First-Class AST Nodes).
collect_comment_attachment()to the parser that collects//and/* */trivia intoCommentAttachment.leading, skipping///doc commentsparse_class_definition,parse_method_definition,parse_state_declaration,parse_classvar_declarationcollect_doc_comment()forStateDeclaration(previously missing)commentsfieldsLinear: https://linear.app/beamtalk/issue/BT-975
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests