nyash-codex
eee3dfaa83
refactor(builder): 箱理論リファクタリング Phase 1完了
🎯 builder_calls.rs (982行) を箱理論で責務別にモジュール分割
## 成果
✅ builder_calls.rs: 982行 → 766行(-216行、22%削減)
✅ calls/lowering.rs: 354行(新規、箱理論6段階パターン)
✅ calls/utils.rs: 45行(新規、ユーティリティ統一)
✅ ビルド・テスト完全成功(0エラー)
## 箱理論の実装
1. 責務ごとに箱に分離:
- lowering: 関数lowering専用
- utils: ユーティリティ統一
- emit/build: Phase 2で実装予定
2. 境界を明確に:
- mod.rs で公開インターフェース定義
- pub(in crate::mir::builder) で適切な可視性制御
3. いつでも戻せる:
- 段階的移行、各ステップでビルド確認
- 既存API完全保持(互換性100%)
4. 巨大関数は分割:
- lower_static_method_as_function: 125行 → 6段階に分解
- lower_method_as_function: 80行 → 6段階に分解
## 箱理論6段階パターン
1. prepare_lowering_context - Context準備
2. create_function_skeleton - 関数スケルトン作成
3. setup_function_params - パラメータ設定
4. lower_function_body - 本体lowering
5. finalize_function - 関数finalize
6. restore_lowering_context - Context復元
## ファイル構成
src/mir/builder/
├── calls/
│ ├── mod.rs # 公開インターフェース
│ ├── lowering.rs # 関数lowering(354行)
│ └── utils.rs # ユーティリティ(45行)
└── builder_calls.rs # 削減版(766行)
## 次のステップ
Phase 2: emit.rs 作成(~500行移行)
Phase 3: build.rs 作成(~350行移行)
最終目標: builder_calls.rs を200行以内に
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Task先生 <task@anthropic.com>
2025-11-17 17:02:01 +09:00
..
2025-11-17 17:02:01 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 07:58:44 +09:00
2025-09-28 20:38:09 +09:00
2025-09-28 12:19:49 +09:00
2025-11-13 16:40:58 +09:00
2025-11-17 00:48:18 +09:00
2025-09-28 20:38:09 +09:00
2025-11-17 03:19:03 +09:00
2025-11-17 08:41:50 +09:00
2025-09-28 20:38:09 +09:00
2025-11-17 17:02:01 +09:00
2025-09-24 01:05:44 +09:00
2025-11-17 11:28:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 11:28:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 11:28:18 +09:00
2025-11-17 00:48:18 +09:00
2025-11-13 20:16:20 +09:00
2025-11-17 11:28:18 +09:00
2025-09-18 13:35:38 +09:00
2025-11-17 00:48:18 +09:00
2025-09-28 20:38:09 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 00:48:18 +09:00
2025-09-11 05:22:52 +09:00
2025-11-17 07:58:44 +09:00
2025-11-17 00:48:18 +09:00
2025-11-17 09:39:26 +09:00
2025-10-31 20:18:39 +09:00