🔧 Fix peek expression terminator issues and add ternary operator support

- Fix LLVM IR terminator missing in peek expression entry blocks
- Add proper jump instructions between peek blocks
- Implement ternary operator (? :) as syntactic sugar for peek
- Update Python LLVM externcall handling for improved compatibility
- Add comprehensive test cases for peek and ternary expressions
- Update language guide with ternary operator documentation

ChatGPTが頑張って修正してくれたにゃ!🐱

Co-Authored-By: ChatGPT <noreply@openai.com>
This commit is contained in:
Selfhosting Dev
2025-09-14 20:30:38 +09:00
parent 8f1b2ffa12
commit 5cad0ab20c
17 changed files with 241 additions and 38 deletions

View File

@ -151,15 +151,14 @@ impl NyashRunner {
.status()
.map_err(|e| format!("spawn pyvm: {}", e))
.unwrap();
// Always propagate PyVM exit code to match llvmlite semantics
let code = status.code().unwrap_or(1);
if !status.success() {
eprintln!("❌ PyVM failed (status={})", status.code().unwrap_or(-1));
process::exit(1);
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
eprintln!("❌ PyVM failed (status={})", code);
}
}
// Propagate exit code if set
if let Some(code) = status.code() {
process::exit(code);
}
process::exit(0);
process::exit(code);
} else {
eprintln!("❌ PyVM runner not found: {}", runner.display());
process::exit(1);