## 🎉 Step 2: peek→match完全統一アーキテクチャクリーンアップ完了 - ✅ 15ファイルで PeekExpr → MatchExpr 一括置換完了 - ✅ lowering/peek.rs → match_expr.rs 完全移行 - ✅ AI理解性・コードベース一貫性・保守性大幅向上 ## 🔍 Step 3: 複数行パース問題調査完了 - ✅ Task先生による根本原因特定完了 - 原因: オブジェクトリテラルパーサーの改行スキップ不足 - 修正: src/parser/expr/primary.rs の skip_newlines() 追加 ## 🚨 重大発見: PHI命令処理バグ - 問題: gemini_test_case.nyash で期待値2→実際0 - 原因: フェーズM+M.2のPHI統一作業でループ後変数マージに回帰バグ - 詳細: PHI命令は正常だが、print時に間違ったPHI参照 - 影響: Phase 15セルフホスティング基盤の重大バグ ## 📝 CLAUDE.md更新 - 全進捗状況の詳細記録 - 次のアクション: ChatGPT相談でMIRビルダー修正戦略立案 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
1.0 KiB
Rust
29 lines
1.0 KiB
Rust
use crate::parser::NyashParser;
|
|
|
|
#[test]
|
|
fn parse_match_with_block_arm() {
|
|
let src = r#"
|
|
local x = 2
|
|
local y = match x {
|
|
1 => { local a = 10 a }
|
|
2 => { 20 }
|
|
_ => { 30 }
|
|
}
|
|
"#;
|
|
let ast = NyashParser::parse_from_string(src).expect("parse ok");
|
|
// Quick structural check: ensure AST contains MatchExpr and Program nodes inside arms
|
|
fn find_peek(ast: &crate::ast::ASTNode) -> bool {
|
|
match ast {
|
|
crate::ast::ASTNode::MatchExpr { arms, else_expr, .. } => {
|
|
// Expect at least one Program arm
|
|
let has_block = arms.iter().any(|(_, e)| matches!(e, crate::ast::ASTNode::Program { .. }));
|
|
let else_is_block = matches!(**else_expr, crate::ast::ASTNode::Program { .. });
|
|
has_block && else_is_block
|
|
}
|
|
crate::ast::ASTNode::Program { statements, .. } => statements.iter().any(find_peek),
|
|
_ => false,
|
|
}
|
|
}
|
|
assert!(find_peek(&ast), "expected peek with block arms in AST");
|
|
}
|