From 6e23f8e5f4d28eb2056d0b3636b8317b9f299bfc Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 26 Nov 2019 02:36:38 -0800 Subject: Print only literal values when printing literals (#2469) Current `<<` operator on `Literal` prints `[type].const` with it. But `[type].const` is rather an instruction than a literal itself, and printing it with the literals makes less sense when we later have literals whose type don't have `const` instructions (such as reference types). This patch - Makes `<<` operator on `Literal` print only its value - Makes wasm-shell's shell interface comply with the spec interpreter's printing format (`value : type`). - Prints wasm-shell's `[trap]` message to stderr These make all `fix_` routines for spec tests in check.py unnecessary. --- src/shell-interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/shell-interface.h') diff --git a/src/shell-interface.h b/src/shell-interface.h index 72c7dc67b..71e09189d 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -135,7 +135,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { Literal callImport(Function* import, LiteralList& arguments) override { if (import->module == SPECTEST && import->base == PRINT) { for (auto argument : arguments) { - std::cout << '(' << argument << ')' << '\n'; + std::cout << argument << " : " << argument.type << '\n'; } return Literal(); } else if (import->module == ENV && import->base == EXIT) { @@ -211,7 +211,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { } void trap(const char* why) override { - std::cout << "[trap " << why << "]\n"; + std::cerr << "[trap " << why << "]\n"; throw TrapException(); } }; -- cgit v1.2.3