diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-01-06 11:25:46 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-01-06 11:25:46 -0800 |
commit | b376986e36c7ba9bb85bb558be54842280633877 (patch) | |
tree | b1e1e602caaf9e0029a03109c7dc4569989cd3f4 /src/s2wasm.h | |
parent | da223dd8af711c47554dddce0727fe927a769a17 (diff) | |
download | binaryen-b376986e36c7ba9bb85bb558be54842280633877.tar.gz binaryen-b376986e36c7ba9bb85bb558be54842280633877.tar.bz2 binaryen-b376986e36c7ba9bb85bb558be54842280633877.zip |
set function type of imports in s2wasm #68
Diffstat (limited to 'src/s2wasm.h')
-rw-r--r-- | src/s2wasm.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 4811632b1..9d50693e9 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -552,12 +552,6 @@ private: auto specific = allocator.alloc<CallImport>(); specific->target = target; curr = specific; - if (wasm.importsMap.count(target) == 0) { - auto import = allocator.alloc<Import>(); - import->name = import->base = target; - import->module = ENV; - wasm.addImport(import); - } } } curr->type = type; @@ -585,6 +579,15 @@ private: } else { call->fullType = wasm.functionTypesMap[typeName]; } + } else if (curr->is<CallImport>()) { + auto target = curr->cast<CallImport>()->target; + if (wasm.importsMap.count(target) == 0) { + auto import = allocator.alloc<Import>(); + import->name = import->base = target; + import->module = ENV; + import->type = sigToFunctionType(getSig(curr)); + wasm.addImport(import); + } } }; auto handleTyped = [&](WasmType type) { @@ -1070,6 +1073,7 @@ public: auto import = parent->allocator.alloc<Import>(); import->name = import->base = curr->target; import->module = ENV; + import->type = sigToFunctionType(getSig(curr)); parent->wasm.addImport(import); } } |