diff --git a/cranelift/src/clif-util.rs b/cranelift/src/clif-util.rs index 676e9d334f..0c6110f024 100755 --- a/cranelift/src/clif-util.rs +++ b/cranelift/src/clif-util.rs @@ -119,6 +119,18 @@ fn add_enable_multi_value<'a>() -> clap::Arg<'a, 'a> { .help("Enable WASM's multi-value support") } +fn add_just_decode_flag<'a>() -> clap::Arg<'a, 'a> { + Arg::with_name("just-decode") + .short("t") + .help("Just decode into Cranelift IR") +} + +fn add_check_translation_flag<'a>() -> clap::Arg<'a, 'a> { + Arg::with_name("check-translation") + .short("c") + .help("Just checks the correctness of Cranelift IR translated from WebAssembly") +} + /// Returns a vector of clap value options and changes these options into a vector of strings fn get_vec(argument_vec: Option) -> Vec { let mut ret_vec: Vec = Vec::new(); @@ -151,6 +163,8 @@ fn add_wasm_or_compile<'a>(cmd: &str) -> clap::App<'a, 'a> { .arg(add_debug_flag()) .arg(add_enable_simd_flag()) .arg(add_enable_multi_value()) + .arg(add_just_decode_flag()) + .arg(add_check_translation_flag()) } fn handle_debug_flag(debug: bool) { @@ -191,17 +205,7 @@ fn main() { .arg(add_input_file_arg()) .arg(add_debug_flag()), ) - .subcommand( - add_wasm_or_compile("compile") - .arg( - Arg::with_name("just-decode") - .short("t") - .help("Just decode WebAssembly to Cranelift IR"), - ) - .arg(Arg::with_name("check-translation").short("c").help( - "Just checks the correctness of Cranelift IR translated from WebAssembly", - )), - ) + .subcommand(add_wasm_or_compile("compile")) .subcommand( add_wasm_or_compile("wasm").arg( Arg::with_name("value-ranges")