Phase 33 NORM canon test: enforce normalized dev route for P1/P2/JP mini
This commit is contained in:
@ -19,11 +19,11 @@
|
||||
//! Phase 231 starts with Pattern2-specific implementation to validate the design.
|
||||
//! Future phases will generalize to Pattern1, Pattern3, etc.
|
||||
|
||||
use crate::mir::ValueId;
|
||||
use super::carrier_info::CarrierInfo;
|
||||
use super::condition_env::ConditionEnv;
|
||||
use super::loop_body_local_env::LoopBodyLocalEnv;
|
||||
use super::carrier_info::CarrierInfo;
|
||||
use crate::mir::loop_pattern_detection::function_scope_capture::CapturedEnv;
|
||||
use crate::mir::ValueId;
|
||||
|
||||
/// Phase 231: Scope kind for variables
|
||||
///
|
||||
@ -146,8 +146,7 @@ impl<'a> ScopeManager for Pattern2ScopeManager<'a> {
|
||||
}
|
||||
|
||||
// 4. Promoted LoopBodyLocal → Carrier lookup(命名規約は CarrierInfo 側に集約)
|
||||
self.carrier_info
|
||||
.resolve_promoted_join_id(name)
|
||||
self.carrier_info.resolve_promoted_join_id(name)
|
||||
}
|
||||
|
||||
fn scope_of(&self, name: &str) -> Option<VarScopeKind> {
|
||||
@ -182,7 +181,7 @@ impl<'a> ScopeManager for Pattern2ScopeManager<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::join_ir::lowering::carrier_info::{CarrierVar, CarrierRole, CarrierInit};
|
||||
use crate::mir::join_ir::lowering::carrier_info::{CarrierInit, CarrierRole, CarrierVar};
|
||||
use crate::mir::loop_pattern_detection::function_scope_capture::CapturedVar;
|
||||
|
||||
#[test]
|
||||
@ -218,15 +217,13 @@ mod tests {
|
||||
let carrier_info = CarrierInfo {
|
||||
loop_var_name: "i".to_string(),
|
||||
loop_var_id: ValueId(1),
|
||||
carriers: vec![
|
||||
CarrierVar {
|
||||
name: "sum".to_string(),
|
||||
host_id: ValueId(2),
|
||||
join_id: Some(ValueId(101)),
|
||||
role: CarrierRole::LoopState,
|
||||
init: CarrierInit::FromHost,
|
||||
},
|
||||
],
|
||||
carriers: vec![CarrierVar {
|
||||
name: "sum".to_string(),
|
||||
host_id: ValueId(2),
|
||||
join_id: Some(ValueId(101)),
|
||||
role: CarrierRole::LoopState,
|
||||
init: CarrierInit::FromHost,
|
||||
}],
|
||||
trim_helper: None,
|
||||
promoted_loopbodylocals: vec![],
|
||||
};
|
||||
@ -250,15 +247,13 @@ mod tests {
|
||||
let carrier_info = CarrierInfo {
|
||||
loop_var_name: "i".to_string(),
|
||||
loop_var_id: ValueId(1),
|
||||
carriers: vec![
|
||||
CarrierVar {
|
||||
name: "is_digit_pos".to_string(),
|
||||
host_id: ValueId(2),
|
||||
join_id: Some(ValueId(102)),
|
||||
role: CarrierRole::ConditionOnly,
|
||||
init: CarrierInit::BoolConst(false),
|
||||
},
|
||||
],
|
||||
carriers: vec![CarrierVar {
|
||||
name: "is_digit_pos".to_string(),
|
||||
host_id: ValueId(2),
|
||||
join_id: Some(ValueId(102)),
|
||||
role: CarrierRole::ConditionOnly,
|
||||
init: CarrierInit::BoolConst(false),
|
||||
}],
|
||||
trim_helper: None,
|
||||
promoted_loopbodylocals: vec!["digit_pos".to_string()],
|
||||
};
|
||||
@ -307,7 +302,8 @@ mod tests {
|
||||
condition_env.insert("i".to_string(), ValueId(100));
|
||||
condition_env.insert("len".to_string(), ValueId(201));
|
||||
|
||||
let mut captured_env = crate::mir::loop_pattern_detection::function_scope_capture::CapturedEnv::new();
|
||||
let mut captured_env =
|
||||
crate::mir::loop_pattern_detection::function_scope_capture::CapturedEnv::new();
|
||||
captured_env.add_var(CapturedVar {
|
||||
name: "len".to_string(),
|
||||
host_id: ValueId(42),
|
||||
|
||||
Reference in New Issue
Block a user