Use the correct index for printing function definitions when imports are present.
This commit is contained in:
@@ -326,7 +326,6 @@ fn pretty_print_translation(
|
|||||||
let mut terminal = term::stdout().unwrap();
|
let mut terminal = term::stdout().unwrap();
|
||||||
let mut parser = Parser::new(data);
|
let mut parser = Parser::new(data);
|
||||||
let mut parser_writer = Writer::new(writer_wat);
|
let mut parser_writer = Writer::new(writer_wat);
|
||||||
let imports_count = runtime.imported_funcs.len();
|
|
||||||
match parser.read() {
|
match parser.read() {
|
||||||
s @ &ParserState::BeginWasm { .. } => parser_writer.write(s)?,
|
s @ &ParserState::BeginWasm { .. } => parser_writer.write(s)?,
|
||||||
_ => panic!("modules should begin properly"),
|
_ => panic!("modules should begin properly"),
|
||||||
@@ -377,11 +376,8 @@ fn pretty_print_translation(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut function_string = format!(
|
let mut function_string =
|
||||||
" {}",
|
format!(" {}", translation.functions[function_index].display(isa));
|
||||||
translation.functions[function_index + imports_count]
|
|
||||||
.display(isa)
|
|
||||||
);
|
|
||||||
function_string.pop();
|
function_string.pop();
|
||||||
let function_str = str::replace(function_string.as_str(), "\n", "\n ");
|
let function_str = str::replace(function_string.as_str(), "\n", "\n ");
|
||||||
terminal.fg(term::color::CYAN).unwrap();
|
terminal.fg(term::color::CYAN).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user