Working map gen

This commit is contained in:
2026-06-14 04:06:39 +02:00
parent db3ae3f37e
commit 33d6c931f5
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ pub trait GetRust {
pub struct RustCodegen { pub struct RustCodegen {
output: String, output: String,
indent: usize, indent: usize,
mapping: HashSet<(RustMap, MistMap)>, pub mapping: HashSet<(RustMap, MistMap)>,
position: RustMap, position: RustMap,
} }
+15 -1
View File
@@ -238,13 +238,27 @@ fn transpile_file(path *PathBuf, source *str, mut output_file PathBuf, mod_decl
let res = fs::write(&output_file, format!("{mod_decl}{output}")); let res = fs::write(&output_file, format!("{mod_decl}{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(),
);
}
if res.is_err() { if res.is_err() {
eprintln!( eprintln!(
"error: failed to write output {}\n {}", "error: failed to write output {}\n {}",
output_file.display(), output_file.display(),
res.unwrap_err(), res.as_ref().unwrap_err(),
); );
}
if res_map.is_err() || res.is_err() {
process::exit(1); process::exit(1);
} }
} }