Working map gen
This commit is contained in:
@@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user