Fixed mapping
This commit is contained in:
@@ -58,7 +58,7 @@ pub bool build(Vec<String> mut args, PathBuf root)
|
||||
serde_json::from_str<rev_mapper::Mapping>(&map_str).expect("Failed to parse map file")
|
||||
});
|
||||
let mist_file = map.mist_path.strip_prefix(&root);
|
||||
let (_, rev_mapper::MistMap(line, column)) = map.find(&rev_mapper::RustMap(span.line_end, span.column_start)).expect("Unable to find mapping");
|
||||
let (_, rev_mapper::MistMap(line, column)) = map.find(&rev_mapper::RustMap(span.line_end, span.column_start)).unwrap_or_default();
|
||||
let mist_msg = MistDiagnosticMessage {
|
||||
message: format!("{}: {}",
|
||||
msg.message.message,
|
||||
|
||||
@@ -222,13 +222,16 @@ pub void transpile_file(PathBuf& path, str& source, PathBuf output_file, str& mo
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
if let Some(parent) = output_file.parent() {
|
||||
let _ = fs::create_dir_all(parent);
|
||||
}
|
||||
let res = fs::write(&output_file, output);
|
||||
let output_file_map = output_file.with_extension("map.json");
|
||||
let res_map = fs::write(&output_file_map, serde_json::to_string(&gc.mapping).unwrap());
|
||||
if res_map.is_err() {
|
||||
eprintln!("error: failed to write mapping output {}\n {}",
|
||||
output_file_map.display(),
|
||||
res.as_ref().unwrap_err(),);
|
||||
res_map.as_ref().unwrap_err(),);
|
||||
}
|
||||
if res.is_err() {
|
||||
eprintln!("error: failed to write output {}\n {}",
|
||||
|
||||
Reference in New Issue
Block a user