複数宣言子 (int x, y;) の 2 個目以降の識別子取りこぼしを修正#47
Merged
Conversation
…aration
collect_definitions took only the first `declarator` field, so bare
field_identifiers after the first (`struct S { int x, y; };` の y) were
dropped — wrapped declarators survived via child recursion, bare struct
members did not. Iterate children_by_field_name to cover them all.
Closes #41
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthrough
ChangesIdentifier collection
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
int x, y;) の 2 個目以降の識別子取りこぼしを修正
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.
概要
struct S { int x, y; };のように 1 宣言に複数のメンバ宣言子を並べた場合、識別子抽出が 2 個目以降を取りこぼすバグ (#41) を修正する。「過剰検出は安全・取りこぼしだけが依存漏れ」という設計 invariant への違反だった。変更内容
collect_definitionsのchild_by_field_name("declarator")をchildren_by_field_name("declarator", ..)に変更し、全宣言子を舐めるようにした (nameフィールドも同一ループのため統一的に複数対応)captures_all_declarators_in_one_declarationを追加 (むき出しint x, y;と初期化子付きint a = 0, b = 0;の両方)検証
auto受け + 落ちる側のyだけ参照) を実際にバンドルし、main では prune されていたtype.hppがバンドルに残り、コンパイル・実行まで通ることを確認Closes #41
🤖 Generated with Claude Code
Summary by CodeRabbit
int x, y;.