phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0

This commit is contained in:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -26,32 +26,25 @@ impl NyashRunner {
process::exit(1);
}
};
// Using preprocessing with AST-prelude merge (when NYASH_USING_AST=1)
let mut code2 = code;
let use_ast_prelude =
crate::config::env::enable_using() && crate::config::env::using_ast_enabled();
// Using preprocessing: 仕様維持のためテキスト・プレリュード統合を既定にASTマージは任意
let mut code2 = code.clone();
if crate::config::env::enable_using() {
// Always perform text-prelude merge when using+AST is enabled to ensure alias/file modules are materialized.
if use_ast_prelude {
match crate::runner::modes::common_util::resolve::merge_prelude_text(self, &code2, filename) {
Ok(merged) => {
if std::env::var("NYASH_RESOLVE_TRACE").ok().as_deref() == Some("1") {
eprintln!("[using/text-merge] applied (vm-fallback): {} bytes", merged.len());
}
code2 = merged;
match crate::runner::modes::common_util::resolve::merge_prelude_text(self, &code2, filename) {
Ok(merged) => {
if std::env::var("NYASH_RESOLVE_TRACE").ok().as_deref() == Some("1") {
eprintln!("[using/text-merge] applied (vm-fallback): {} bytes", merged.len());
}
Err(e) => { eprintln!("❌ using text merge error: {}", e); process::exit(1); }
}
} else {
match crate::runner::modes::common_util::resolve::resolve_prelude_paths_profiled(self, &code2, filename) {
Ok((_clean, paths)) => {
if !paths.is_empty() {
eprintln!("❌ using: prelude merge is disabled in this profile. Enable NYASH_USING_AST=1 or remove 'using' lines.");
process::exit(1);
}
}
Err(e) => { eprintln!("{}", e); process::exit(1); }
code2 = merged;
}
Err(e) => { eprintln!("❌ using text merge error: {}", e); process::exit(1); }
}
} else {
// using disabled: detect and fail fast if present
if code.contains("\nusing ") || code.trim_start().starts_with("using ") {
eprintln!(
"❌ using: prelude merge is disabled in this profile. Enable NYASH_USING_AST=1 or remove 'using' lines."
);
process::exit(1);
}
}
// Dev sugar pre-expand: @name = expr → local name = expr
@ -242,7 +235,7 @@ impl NyashRunner {
// Optional barrier-elision for parity with VM path
let mut module_vm = compile.module.clone();
if std::env::var("NYASH_VM_ESCAPE_ANALYSIS").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_ESCAPE_ANALYSIS") {
let removed = crate::mir::passes::escape::escape_elide_barriers_vm(&mut module_vm);
if removed > 0 {
crate::cli_v!(
@ -253,7 +246,7 @@ impl NyashRunner {
}
// Optional: dump MIR for diagnostics (parity with vm path)
if std::env::var("NYASH_VM_DUMP_MIR").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_DUMP_MIR") {
let p = crate::mir::MirPrinter::new();
eprintln!("{}", p.print_module(&module_vm));
}
@ -261,7 +254,7 @@ impl NyashRunner {
// Execute via MIR interpreter
let mut vm = MirInterpreter::new();
// Optional: verify MIR before execution (dev-only)
if std::env::var("NYASH_VM_VERIFY_MIR").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_VERIFY_MIR") {
let mut verifier = crate::mir::verification::MirVerifier::new();
for (name, func) in module_vm.functions.iter() {
if let Err(errors) = verifier.verify_function(func) {