diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index e9d2bf116..7bf9b8604 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -1164,6 +1164,10 @@ Function* Module::getFunction(Name name) { return getModuleElement(functionsMap, name, "getFunction"); } +Table* Module::getTable(Name name) { + return getModuleElement(tablesMap, name, "getTable"); +} + Global* Module::getGlobal(Name name) { return getModuleElement(globalsMap, name, "getGlobal"); } @@ -1189,6 +1193,10 @@ Function* Module::getFunctionOrNull(Name name) { return getModuleElementOrNull(functionsMap, name); } +Table* Module::getTableOrNull(Name name) { + return getModuleElementOrNull(tablesMap, name); +} + Global* Module::getGlobalOrNull(Name name) { return getModuleElementOrNull(globalsMap, name); } @@ -1254,6 +1262,10 @@ Function* Module::addFunction(std::unique_ptr<Function>&& curr) { functions, functionsMap, std::move(curr), "addFunction"); } +Table* Module::addTable(std::unique_ptr<Table>&& curr) { + return addModuleElement(tables, tablesMap, std::move(curr), "addTable"); +} + Global* Module::addGlobal(std::unique_ptr<Global>&& curr) { return addModuleElement(globals, globalsMap, std::move(curr), "addGlobal"); } @@ -1281,6 +1293,9 @@ void Module::removeExport(Name name) { void Module::removeFunction(Name name) { removeModuleElement(functions, functionsMap, name); } +void Module::removeTable(Name name) { + removeModuleElement(tables, tablesMap, name); +} void Module::removeGlobal(Name name) { removeModuleElement(globals, globalsMap, name); } @@ -1310,6 +1325,9 @@ void Module::removeExports(std::function<bool(Export*)> pred) { void Module::removeFunctions(std::function<bool(Function*)> pred) { removeModuleElements(functions, functionsMap, pred); } +void Module::removeTables(std::function<bool(Table*)> pred) { + removeModuleElements(tables, tablesMap, pred); +} void Module::removeGlobals(std::function<bool(Global*)> pred) { removeModuleElements(globals, globalsMap, pred); } @@ -1326,6 +1344,10 @@ void Module::updateMaps() { for (auto& curr : exports) { exportsMap[curr->name] = curr.get(); } + tablesMap.clear(); + for (auto& curr : tables) { + tablesMap[curr->name] = curr.get(); + } globalsMap.clear(); for (auto& curr : globals) { globalsMap[curr->name] = curr.get(); |