feat(mir-builder): add using imports support to json_v0_bridge
Phase 21.8 foundation for MatI64/IntArrayCore integration Changes: - Add `imports: HashMap<String, String>` to BridgeEnv - Extend MapVars::resolve() to check imports and create static box references - Add BridgeEnv::with_imports() to initialize with using imports map - Add parse_json_v0_to_module_with_imports() to json_v0_bridge - Add program_json_to_mir_json_with_imports() to mir_builder.rs - Maintain backward compatibility via empty HashMap defaults Next: Wire using extraction from pipeline and test with MatI64 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,8 +4,13 @@ mod lowering;
|
||||
|
||||
use ast::{ProgramV0, StmtV0};
|
||||
use lowering::lower_program;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn parse_json_v0_to_module(json: &str) -> Result<crate::mir::MirModule, String> {
|
||||
parse_json_v0_to_module_with_imports(json, HashMap::new())
|
||||
}
|
||||
|
||||
pub fn parse_json_v0_to_module_with_imports(json: &str, imports: HashMap<String, String>) -> Result<crate::mir::MirModule, String> {
|
||||
let prog: ProgramV0 =
|
||||
serde_json::from_str(json).map_err(|e| format!("invalid JSON v0: {}", e))?;
|
||||
if crate::config::env::cli_verbose() {
|
||||
@ -19,7 +24,7 @@ pub fn parse_json_v0_to_module(json: &str) -> Result<crate::mir::MirModule, Stri
|
||||
if prog.version != 0 || prog.kind != "Program" {
|
||||
return Err("unsupported IR: expected {version:0, kind:\"Program\"}".into());
|
||||
}
|
||||
lower_program(prog)
|
||||
lower_program(prog, imports)
|
||||
}
|
||||
|
||||
pub fn parse_source_v0_to_module(input: &str) -> Result<crate::mir::MirModule, String> {
|
||||
|
||||
Reference in New Issue
Block a user