summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/js-wrapper.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h
index a787d4d2c..0a9b5925e 100644
--- a/src/tools/js-wrapper.h
+++ b/src/tools/js-wrapper.h
@@ -47,13 +47,13 @@ static std::string generateJSWrapper(Module& wasm) {
" }\n"
"}\n"
"function literal(x, type) {\n"
- " var ret = type + '.const ';\n"
+ " var ret = '';\n"
" switch (type) {\n"
" case 'i32': ret += (x | 0); break;\n"
" case 'f32':\n"
" case 'f64': {\n"
" if (x == 0 && (1 / x) < 0) ret += '-';\n"
- " ret += x;\n"
+ " ret += Number(x).toString();\n"
" break;\n"
" }\n"
" default: throw 'what?';\n"
@@ -82,17 +82,17 @@ static std::string generateJSWrapper(Module& wasm) {
" },\n"
"});\n";
for (auto& exp : wasm.exports) {
- auto* func = wasm.getFunctionOrNull(exp->value);
- if (!func) {
+ if (exp->kind != ExternalKind::Function) {
continue; // something exported other than a function
}
+ auto* func = wasm.getFunction(exp->value);
ret += "if (instance.exports.hangLimitInitializer) "
"instance.exports.hangLimitInitializer();\n";
ret += "try {\n";
- ret += std::string(" console.log('[fuzz-exec] calling $") + exp->name.str +
+ ret += std::string(" console.log('[fuzz-exec] calling ") + exp->name.str +
"');\n";
if (func->sig.results != Type::none) {
- ret += std::string(" console.log('[fuzz-exec] note result: $") +
+ ret += std::string(" console.log('[fuzz-exec] note result: ") +
exp->name.str + " => ' + literal(";
} else {
ret += " ";