feat(phase32): L-2.1 Stage-1 UsingResolver JoinIR integration + cleanup
Phase 32 L-2.1 complete implementation: 1. Stage-1 UsingResolver main line JoinIR connection - CFG-based LoopForm construction for resolve_for_source/5 - LoopToJoinLowerer integration with handwritten fallback - JSON snapshot tests 6/6 PASS 2. JoinIR/VM Bridge improvements - Simplified join_ir_vm_bridge.rs dispatch logic - Enhanced json.rs serialization - PHI core boxes cleanup (local_scope_inspector, loop_exit_liveness, loop_var_classifier) 3. Stage-1 CLI enhancements - Extended args.rs, groups.rs, mod.rs for new options - Improved stage1_bridge module (args, env, mod) - Updated stage1_cli.hako 4. MIR builder cleanup - Simplified if_form.rs control flow - Removed dead code from loop_builder.rs - Enhanced phi_merge.rs 5. Runner module updates - json_v0_bridge/lowering.rs improvements - dispatch.rs, selfhost.rs, modes/vm.rs cleanup 6. Documentation updates - CURRENT_TASK.md, AGENTS.md - Various docs/ updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -92,8 +92,11 @@ impl NyashRunner {
|
||||
return;
|
||||
}
|
||||
let groups = self.config.as_groups();
|
||||
if let Some(code) = self.maybe_run_stage1_cli_stub(&groups) {
|
||||
std::process::exit(code);
|
||||
let skip_stage1_stub = groups.emit.hako_emit_program_json || groups.emit.hako_emit_mir_json;
|
||||
if !skip_stage1_stub {
|
||||
if let Some(code) = self.maybe_run_stage1_cli_stub(&groups) {
|
||||
std::process::exit(code);
|
||||
}
|
||||
}
|
||||
// Early: direct MIR JSON execution (no source file). Experimental diagnostics/exec.
|
||||
if let Some(path) = groups.parser.mir_json_file.as_ref() {
|
||||
@ -139,6 +142,50 @@ impl NyashRunner {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Emit Program(JSON v0) and exit
|
||||
if let Some(path) = groups.emit.emit_program_json.as_ref() {
|
||||
// Prefer Stage-1/.hako route when requested via hako-* flags or env
|
||||
let use_hako = groups.emit.hako_emit_program_json
|
||||
|| crate::config::env::stage1::emit_program_json()
|
||||
|| crate::config::env::stage1::enabled();
|
||||
if use_hako {
|
||||
if let Err(e) = self.emit_program_json_v0(&groups, path) {
|
||||
eprintln!("❌ emit-program-json error: {}", e);
|
||||
std::process::exit(1);
|
||||
} else {
|
||||
println!("Program JSON written: {}", path);
|
||||
std::process::exit(0);
|
||||
}
|
||||
} else if let Some(file) = groups.input.file.as_ref() {
|
||||
match std::fs::read_to_string(file) {
|
||||
Ok(code) => match crate::parser::NyashParser::parse_from_string(&code) {
|
||||
Ok(ast) => {
|
||||
let prog = crate::r#macro::ast_json::ast_to_json(&ast);
|
||||
let out_path = std::path::Path::new(path);
|
||||
if let Err(e) = std::fs::write(out_path, prog.to_string()) {
|
||||
eprintln!("❌ emit-program-json write error: {}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
println!("Program JSON written: {}", out_path.display());
|
||||
std::process::exit(0);
|
||||
}
|
||||
Err(e) => {
|
||||
crate::runner::modes::common_util::diag::print_parse_error_with_context(
|
||||
file, &code, &e,
|
||||
);
|
||||
std::process::exit(1);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("❌ Error reading file {}: {}", file, e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
eprintln!("❌ --emit-program-json requires an input file");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
// Preprocess usings and directives (includes dep-tree log)
|
||||
self.preprocess_usings_and_directives(&groups);
|
||||
// JSON v0 bridge
|
||||
|
||||
Reference in New Issue
Block a user