diff --git a/src/mir/builder/control_flow/joinir/patterns/loop_scope_shape_builder.rs b/src/mir/builder/control_flow/joinir/patterns/loop_scope_shape_builder.rs index fad37b2c..feb18602 100644 --- a/src/mir/builder/control_flow/joinir/patterns/loop_scope_shape_builder.rs +++ b/src/mir/builder/control_flow/joinir/patterns/loop_scope_shape_builder.rs @@ -1,4 +1,4 @@ -//! LoopScopeShapeBuilder - Unified LoopScopeShape initialization +//! LoopScopeShapeBuilder - AST-based LoopScopeShape initialization //! //! Phase 171-172: Issue 4 //! @@ -11,6 +11,14 @@ //! - Extract body_locals from loop body AST when needed //! - Maintain consistent initialization defaults across patterns //! +//! # Phase 183-3: AST-Based Construction Context +//! +//! This builder constructs LoopScopeShape from **AST nodes** during MIR building. +//! For LoopForm-based construction (JoinIR lowering), see: +//! - `src/mir/join_ir/lowering/loop_scope_shape/builder.rs` +//! +//! Both builders maintain consistent field initialization for LoopScopeShape. +//! //! # Usage //! //! ```rust diff --git a/src/mir/join_ir/lowering/loop_scope_shape/builder.rs b/src/mir/join_ir/lowering/loop_scope_shape/builder.rs index 51b3dbc5..eb9767ad 100644 --- a/src/mir/join_ir/lowering/loop_scope_shape/builder.rs +++ b/src/mir/join_ir/lowering/loop_scope_shape/builder.rs @@ -6,6 +6,14 @@ //! Trio legacy boxes は完全に除去済み。 //! LoopForm / LoopFormIntake から LoopScopeShape を構築し、変数分類と定義位置を //! LoopScopeShape の内部に閉じ込める。 +//! +//! # Phase 183-3: LoopForm-Based Construction Context +//! +//! This builder constructs LoopScopeShape from **LoopForm** during JoinIR lowering. +//! For AST-based construction (MIR building), see: +//! - `src/mir/builder/control_flow/joinir/patterns/loop_scope_shape_builder.rs` +//! +//! Both builders maintain consistent field initialization for LoopScopeShape. use std::collections::{BTreeMap, BTreeSet}; diff --git a/src/mir/join_ir/lowering/loop_scope_shape/shape.rs b/src/mir/join_ir/lowering/loop_scope_shape/shape.rs index 91536bcf..83434b90 100644 --- a/src/mir/join_ir/lowering/loop_scope_shape/shape.rs +++ b/src/mir/join_ir/lowering/loop_scope_shape/shape.rs @@ -56,6 +56,20 @@ impl LoopVarClass { /// - Variable classification: `pinned`, `carriers`, `body_locals`, `exit_live` /// - `progress_carrier`: 進捗チェック用(将来の Verifier で使用予定) /// - `variable_definitions`: definition blocks collected from LoopFormIntake snapshots +/// +/// # Phase 183-3: Construction Paths +/// +/// LoopScopeShape has two construction paths depending on context: +/// +/// 1. **AST-based** (MIR building): `patterns/loop_scope_shape_builder.rs` +/// - Extracts body_locals from AST nodes +/// - Used during initial MIR generation from source +/// +/// 2. **LoopForm-based** (JoinIR lowering): `loop_scope_shape/builder.rs` +/// - Analyzes LoopForm and LoopFormIntake +/// - Used during JoinIR lowering from LoopForm +/// +/// Both paths maintain consistent field initialization and variable classification. #[derive(Debug, Clone)] pub(crate) struct LoopScopeShape { pub header: BasicBlockId,