summaryrefslogtreecommitdiff
path: root/src/wasm2asm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm2asm.h')
-rw-r--r--src/wasm2asm.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index 62baf1b54..9921c3e3e 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -165,6 +165,7 @@ private:
void addBasics(Ref ast);
void addImport(Ref ast, Import *import);
void addTables(Ref ast, Module *wasm);
+ void addExports(Ref ast, Module *wasm);
};
Ref Wasm2AsmBuilder::processWasm(Module* wasm) {
@@ -194,8 +195,8 @@ Ref Wasm2AsmBuilder::processWasm(Module* wasm) {
asmFunc[3]->push_back(processFunction(func));
}
addTables(asmFunc[3], wasm);
- // table XXX
// memory XXX
+ addExports(asmFunc[3], wasm);
return ret;
}
@@ -288,6 +289,14 @@ void Wasm2AsmBuilder::addTables(Ref ast, Module *wasm) {
}
}
+void Wasm2AsmBuilder::addExports(Ref ast, Module *wasm) {
+ Ref exports = ValueBuilder::makeObject();
+ for (auto export_ : wasm->exports) {
+ ValueBuilder::appendToObject(exports, fromName(export_->name), ValueBuilder::makeName(fromName(export_->value)));
+ }
+ ast->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(exports)));
+}
+
Ref Wasm2AsmBuilder::processFunction(Function* func) {
Ref ret = ValueBuilder::makeFunction(fromName(func->name));
frees.clear();