summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-binary.cpp8
-rw-r--r--src/wasm/wasm-s-parser.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 456e4505e..f7fa821ea 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -138,7 +138,7 @@ void WasmBinaryWriter::writeImports() {
writeInlineString(import->base.str);
o << U32LEB(int32_t(import->kind));
switch (import->kind) {
- case ExternalKind::Function: o << U32LEB(getFunctionTypeIndex(import->functionType->name)); break;
+ case ExternalKind::Function: o << U32LEB(getFunctionTypeIndex(import->functionType)); break;
case ExternalKind::Table: {
o << S32LEB(BinaryConsts::EncodedType::AnyFunc);
writeResizableLimits(wasm->table.initial, wasm->table.max, wasm->table.max != Table::kMaxSize);
@@ -1198,8 +1198,8 @@ void WasmBinaryBuilder::readImports() {
case ExternalKind::Function: {
auto index = getU32LEB();
assert(index < wasm.functionTypes.size());
- curr->functionType = wasm.functionTypes[index].get();
- assert(curr->functionType->name.is());
+ curr->functionType = wasm.functionTypes[index]->name;
+ assert(curr->functionType.is());
functionImportIndexes.push_back(curr->name);
break;
}
@@ -1703,7 +1703,7 @@ Expression* WasmBinaryBuilder::visitCall() {
auto* call = allocator.alloc<CallImport>();
auto* import = wasm.getImport(functionImportIndexes[index]);
call->target = import->name;
- type = import->functionType;
+ type = wasm.getFunctionType(import->functionType);
fillCall(call, type);
ret = call;
} else {
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 3fcb85c6b..cdec89c74 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -536,7 +536,7 @@ void SExpressionWasmBuilder::parseFunction(Element& s, bool preParseImport) {
im->module = importModule;
im->base = importBase;
im->kind = ExternalKind::Function;
- im->functionType = wasm.getFunctionType(type);
+ im->functionType = wasm.getFunctionType(type)->name;
wasm.addImport(im.release());
assert(!currFunction);
currLocalTypes.clear();
@@ -1199,7 +1199,7 @@ Expression* SExpressionWasmBuilder::makeCall(Element& s) {
auto ret = allocator.alloc<CallImport>();
ret->target = target;
Import* import = wasm.getImport(ret->target);
- ret->type = import->functionType->result;
+ ret->type = wasm.getFunctionType(import->functionType)->result;
parseCallOperands(s, 2, s.size(), ret);
return ret;
}
@@ -1214,7 +1214,7 @@ Expression* SExpressionWasmBuilder::makeCallImport(Element& s) {
auto ret = allocator.alloc<CallImport>();
ret->target = s[1]->str();
Import* import = wasm.getImport(ret->target);
- ret->type = import->functionType->result;
+ ret->type = wasm.getFunctionType(import->functionType)->result;
parseCallOperands(s, 2, s.size(), ret);
return ret;
}
@@ -1556,7 +1556,7 @@ void SExpressionWasmBuilder::parseImport(Element& s) {
type->result = stringToWasmType(result[1]->str());
}
}
- im->functionType = ensureFunctionType(getSig(type.get()), &wasm);
+ im->functionType = ensureFunctionType(getSig(type.get()), &wasm)->name;
} else if (im->kind == ExternalKind::Global) {
if (inner[j]->isStr()) {
im->globalType = stringToWasmType(inner[j]->str());