runner: promote @local expansion to first-class (default ON) across vm & selfhost; docs updated to reflect standard sugar

This commit is contained in:
nyash-codex
2025-09-28 02:05:41 +09:00
parent 1994990f47
commit c409aa6ad1
5 changed files with 16 additions and 2 deletions

View File

@ -116,6 +116,9 @@ impl NyashRunner {
}
} else { code };
// Pre-expand '@name[:T] = expr' sugar at line-head (same as common/llvm/pyvm paths)
let code = crate::runner::modes::common_util::resolve::preexpand_at_local(&code);
// Parse to AST
let ast = match NyashParser::parse_from_string(&code) {
Ok(ast) => ast,

View File

@ -38,6 +38,12 @@ impl NyashRunner {
}
}
// Promote dev sugar to standard: pre-expand line-head '@name[:T] = expr' to 'local name[:T] = expr'
{
let expanded = crate::runner::modes::common_util::resolve::preexpand_at_local(code_ref.as_ref());
code_ref = std::borrow::Cow::Owned(expanded);
}
// Write to tmp/ny_parser_input.ny (as expected by Ny parser v0), unless forced to reuse existing tmp
let use_tmp_only = crate::config::env::ny_compiler_use_tmp_only();
let tmp_dir = std::path::Path::new("tmp");