Updated builder with new mapping

This commit is contained in:
2026-06-15 14:32:51 +02:00
parent bed7b17134
commit 44f10d3fb7
+37 -36
View File
@@ -45,7 +45,7 @@ pub fn build(mut args Vec<String>, root PathBuf) bool {
let mut diagnostics = Vec::new(); let mut diagnostics = Vec::new();
let mut mapping HashMap<rev_mapper::RustMap, rev_mapper::MistMap> = HashMap::new(); let mut mapping = HashMap::new();
let mist_src = format!(".mist{MAIN_SEPARATOR}src"); let mist_src = format!(".mist{MAIN_SEPARATOR}src");
@@ -65,50 +65,51 @@ pub fn build(mut args Vec<String>, root PathBuf) bool {
let mist_path = root.join(&mist_file); let mist_path = root.join(&mist_file);
if !fs::exists(&mist_path).expect("Unable to check if mist file exists") { let mapping_path = rust_path.with_extension("map.json");
if !fs::exists(&mapping_path).expect("Unable to check if map file exists") {
diagnostics.push(MistDiagnostic::Rust(msg)); diagnostics.push(MistDiagnostic::Rust(msg));
break; break;
} }
// let map = mapping.entry(rust_path.clone()).or_insert_with(fn() { let map = mapping.entry(mapping_path.clone()).or_insert_with(fn() {
// rev_mapper::get_mapping( let map_str = fs::read_to_string(mapping_path).expect("Failed to read map file");
// &fs::read_to_string(rust_path)
// .expect("Failed to read file for mapping")
// )
// });
// let [_, rev_mapper::MistMap[line, column]] = serde_json::from_str(&map_str).expect("Failed to parse map file")
// rev_mapper::find_mapping(&map, &rev_mapper::RustMap(span.line_end, span.column_start)) });
// .expect("Unable to find mapping");
// let mist_msg = MistDiagnosticMessage { let [_, rev_mapper::MistMap[line, column]] =
// message: format!( rev_mapper::find_mapping(&map, &rev_mapper::RustMap(span.line_end, span.column_start))
// "{}: {}", .expect("Unable to find mapping");
// msg.message.message,
// span.label.clone().unwrap_or_default()
// ),
// file_name: if is_root {
// (); // TODO: fix this
// mist_file
// } else {
// mist_path.to_string_lossy().to_string()
// },
// file_path: mist_path,
// line: line,
// column: column
// };
// match msg.message.level { let mist_msg = MistDiagnosticMessage {
// cargo_metadata::diagnostic::DiagnosticLevel::Error => { message: format!(
// diagnostics.push(MistDiagnostic::Error(mist_msg)) "{}: {}",
// } msg.message.message,
span.label.clone().unwrap_or_default()
),
file_name: if is_root {
(); // TODO: fix this
mist_file
} else {
mist_path.to_string_lossy().to_string()
},
file_path: mist_path,
line: line,
column: column
};
// cargo_metadata::diagnostic::DiagnosticLevel::Warning => { match msg.message.level {
// diagnostics.push(MistDiagnostic::Warning(mist_msg)) cargo_metadata::diagnostic::DiagnosticLevel::Error => {
// } diagnostics.push(MistDiagnostic::Error(mist_msg))
}
// _ => {} cargo_metadata::diagnostic::DiagnosticLevel::Warning => {
// } diagnostics.push(MistDiagnostic::Warning(mist_msg))
}
_ => {}
}
} }
} }
} }