refactor(mir): Phase 137-6-S1 - choose_pattern_kind SSOT入口を新設
## 目的 Pattern 選択ロジックを SSOT 化し、将来の Canonicalizer 委譲に備える ## 変更内容 ### 新規関数: `choose_pattern_kind()` - 場所: `src/mir/builder/control_flow/joinir/routing.rs` - 責務: Pattern 選択の SSOT 入口 - 実装: 既存の LoopFeatures ベース選択ロジックを集約 ### LoopPatternContext の更新 - `new()` で `choose_pattern_kind()` を使用 - 既存の分散した選択ロジックを SSOT に統一 ## 効果 - ✅ Pattern 選択ロジックの SSOT 化(1箇所に集約) - ✅ 将来の Canonicalizer 委譲に備えた構造確立 - ✅ 既定挙動完全不変(既存テスト全て PASS) ## テスト結果 - ✅ `cargo build --release`: 成功 - ✅ スモークテスト(simple_*): 5/5 PASS - ✅ 退行なし 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -36,15 +36,37 @@ pub static OPERATORS_DIV_RULES: &[(&str, &str, &str, &str)] = &[
|
||||
];
|
||||
pub fn lookup_keyword(word: &str) -> Option<&'static str> {
|
||||
for (k, t) in KEYWORDS {
|
||||
if *k == word {
|
||||
return Some(*t);
|
||||
}
|
||||
if *k == word { return Some(*t); }
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub static SYNTAX_ALLOWED_STATEMENTS: &[&str] = &[
|
||||
"box", "global", "function", "static", "if", "loop", "break", "return", "print", "nowait",
|
||||
"include", "local", "outbox", "try", "throw", "using", "from",
|
||||
"box",
|
||||
"global",
|
||||
"function",
|
||||
"static",
|
||||
"if",
|
||||
"loop",
|
||||
"break",
|
||||
"return",
|
||||
"print",
|
||||
"nowait",
|
||||
"include",
|
||||
"local",
|
||||
"outbox",
|
||||
"try",
|
||||
"throw",
|
||||
"using",
|
||||
"from",
|
||||
];
|
||||
pub static SYNTAX_ALLOWED_BINOPS: &[&str] = &["add", "sub", "mul", "div", "and", "or", "eq", "ne"];
|
||||
pub static SYNTAX_ALLOWED_BINOPS: &[&str] = &[
|
||||
"add",
|
||||
"sub",
|
||||
"mul",
|
||||
"div",
|
||||
"and",
|
||||
"or",
|
||||
"eq",
|
||||
"ne",
|
||||
];
|
||||
Reference in New Issue
Block a user