Implement AST unparser and update extract_method_source (BT-977)#1017
Implement AST unparser and update extract_method_source (BT-977)#1017
Conversation
- Add crates/beamtalk-core/src/unparse/mod.rs with full AST-to-source unparser using the Document/docvec! API (ADR 0044 Phase 4) - Cover all 19 Expression variants, ClassDefinition, MethodDefinition, StateDeclaration, ExpressionStatement with comment attachment - Single-expression methods render inline; multi-expression on new lines - Replace byte-range slicing in extract_method_source with unparser call, fixing missing leading comments and synthesized method fallback - 26 unit tests including round-trip parse→unparse→parse verification - Update 20 codegen snapshots for full method source in CompiledMethod 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 (3)
📝 WalkthroughWalkthroughThis PR introduces a new comprehensive AST unparser module that converts Beamtalk AST nodes back to source text using a Document-based rendering pipeline. It updates the Core Erlang method source extraction to call the unparser instead of slicing source by byte indices, eliminating reliance on source_text and spans. The unparser handles comments, method signatures, class definitions, expressions, literals, and type annotations. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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 ADR 0044 Phase 4: a full AST-to-source unparser using the Document/docvec! API, and updates
extract_method_sourceto use it instead of raw byte-range slicing.Linear issue: https://linear.app/beamtalk/issue/BT-977
Key changes
New module
crates/beamtalk-core/src/unparse/mod.rs(~850 lines of unparse logic + ~450 lines of tests)Updated
extract_method_sourceingen_server/methods.rsunparse_method()call20 codegen snapshots updated —
methodSourceentries now contain full method textTest plan
just cipasses🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Refactor