summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-14 11:51:59 +0200
committerGitHub <noreply@github.com>2020-09-14 11:51:59 +0200
commit18716065cc470c3bc29a4fecf3889891a9bf604b (patch)
treef106abf584fcc2ab1e14320682962326357479e8 /src/wasm/wasm-s-parser.cpp
parent0ade3f2761b0661ab4d1290ab704c594c1d90df9 (diff)
downloadbinaryen-18716065cc470c3bc29a4fecf3889891a9bf604b.tar.gz
binaryen-18716065cc470c3bc29a4fecf3889891a9bf604b.tar.bz2
binaryen-18716065cc470c3bc29a4fecf3889891a9bf604b.zip
Implement module and local names in name section (#3115)
Adds support for the module and local subsections of the name section plus the respective C and JS APIs to populate and obtain local names. C API: * BinaryenFunctionGetNumLocals(func) * BinaryenFunctionHasLocalName(func, index) * BinaryenFunctionGetLocalName(func, index) * BinaryenFunctionSetLocalName(func, index, name) JS API: * Function.getNumLocals(func) * Function.hasLocalName(func, index) * Function.getLocalName(func, index) * Function.setLocalName(func, index, name)
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 97bfe55f9..97da80fea 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -314,8 +314,7 @@ Element* SExpressionParser::parseString() {
SExpressionWasmBuilder::SExpressionWasmBuilder(Module& wasm,
Element& module,
- IRProfile profile,
- Name* moduleName)
+ IRProfile profile)
: wasm(wasm), allocator(wasm.allocator), profile(profile) {
if (module.size() == 0) {
throw ParseException("empty toplevel, expected module");
@@ -328,9 +327,7 @@ SExpressionWasmBuilder::SExpressionWasmBuilder(Module& wasm,
}
Index i = 1;
if (module[i]->dollared()) {
- if (moduleName) {
- *moduleName = module[i]->str();
- }
+ wasm.name = module[i]->str();
i++;
}
if (i < module.size() && module[i]->isStr()) {