Span trace utilities and runner source hint

This commit is contained in:
nyash-codex
2025-11-24 14:17:02 +09:00
parent 3154903121
commit 466e636af6
106 changed files with 4597 additions and 958 deletions

View File

@ -116,9 +116,7 @@ impl NyashRunner {
Ok(ast) => ast,
Err(e) => {
crate::runner::modes::common_util::diag::print_parse_error_with_context(
filename,
&code2,
&e,
filename, &code2, &e,
);
process::exit(1);
}
@ -271,7 +269,11 @@ impl NyashRunner {
}
}
let mut compiler = MirCompiler::with_options(!self.config.no_optimize);
let compile = match compiler.compile(ast) {
let compile = match crate::runner::modes::common_util::source_hint::compile_with_source_hint(
&mut compiler,
ast,
Some(filename),
) {
Ok(c) => c,
Err(e) => {
eprintln!("❌ MIR compilation error: {}", e);
@ -357,7 +359,7 @@ impl NyashRunner {
impl NyashRunner {
/// Small helper to continue fallback execution once AST is prepared
#[allow(dead_code)]
fn execute_vm_fallback_from_ast(&self, _filename: &str, ast: nyash_rust::ast::ASTNode) {
fn execute_vm_fallback_from_ast(&self, filename: &str, ast: nyash_rust::ast::ASTNode) {
use crate::{
backend::MirInterpreter,
box_factory::{BoxFactory, RuntimeError},
@ -471,7 +473,11 @@ impl NyashRunner {
}
// Compile to MIR and execute via interpreter
let mut compiler = MirCompiler::with_options(!self.config.no_optimize);
let module = match compiler.compile(ast) {
let module = match crate::runner::modes::common_util::source_hint::compile_with_source_hint(
&mut compiler,
ast,
Some(filename),
) {
Ok(r) => r.module,
Err(e) => {
eprintln!("❌ MIR compilation error: {}", e);