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

@ -8,6 +8,8 @@ use crate::mir::builder::observe::types as type_trace;
impl super::MirBuilder {
// Main expression dispatcher
pub(super) fn build_expression_impl(&mut self, ast: ASTNode) -> Result<ValueId, String> {
// Track current source span for downstream instruction emission
self.current_span = ast.span();
if std::env::var("NYASH_LOOPFORM_DEBUG").is_ok() {
if matches!(ast, ASTNode::Loop { .. }) {
eprintln!("[build_expression_impl] === ENTRY === processing Loop node");
@ -296,7 +298,8 @@ impl super::MirBuilder {
args: vec![],
effects: super::EffectMask::MUT,
})?;
self.value_origin_newbox.insert(arr_id, "ArrayBox".to_string());
self.value_origin_newbox
.insert(arr_id, "ArrayBox".to_string());
self.value_types
.insert(arr_id, super::MirType::Box("ArrayBox".to_string()));
// TypeRegistry + trace for deterministic debug
@ -339,7 +342,8 @@ impl super::MirBuilder {
args: vec![],
effects: super::EffectMask::MUT,
})?;
self.value_origin_newbox.insert(map_id, "MapBox".to_string());
self.value_origin_newbox
.insert(map_id, "MapBox".to_string());
self.value_types
.insert(map_id, super::MirType::Box("MapBox".to_string()));
self.type_registry