Remove most of cranelift-serde

This commit is contained in:
bjorn3
2020-12-19 16:38:08 +01:00
parent 2fc964ea35
commit 71e468a954
3 changed files with 5 additions and 985 deletions

View File

@@ -22,23 +22,21 @@
)]
use clap::{App, Arg, SubCommand};
use cranelift_codegen::ir::Function;
use cranelift_reader::parse_functions;
use std::fs::File;
use std::io::prelude::*;
use std::io::{self, Write};
use std::process;
mod serde_clif_json;
fn call_ser(file: &str, pretty: bool) -> Result<(), String> {
let ret_of_parse = parse_functions(file);
match ret_of_parse {
Ok(funcs) => {
let ser_funcs = serde_clif_json::SerObj::new(&funcs);
let ser_str = if pretty {
serde_json::to_string_pretty(&ser_funcs).unwrap()
serde_json::to_string_pretty(&funcs).unwrap()
} else {
serde_json::to_string(&ser_funcs).unwrap()
serde_json::to_string(&funcs).unwrap()
};
println!("{}", ser_str);
Ok(())
@@ -48,7 +46,7 @@ fn call_ser(file: &str, pretty: bool) -> Result<(), String> {
}
fn call_de(file: &File) -> Result<(), String> {
let de: serde_clif_json::SerObj = match serde_json::from_reader(file) {
let de: Vec<Function> = match serde_json::from_reader(file) {
Result::Ok(val) => val,
Result::Err(err) => panic!("{}", err),
};