diff options
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index baff0d83f..03ae5ce5a 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2971,15 +2971,12 @@ Expression* WasmBinaryBuilder::popTypedExpression(Type type) { } void WasmBinaryBuilder::validateBinary() { - if (hasDataCount && dataSegments.size() != dataCount) { + if (hasDataCount && wasm.dataSegments.size() != dataCount) { throwError("Number of segments does not agree with DataCount section"); } } void WasmBinaryBuilder::processNames() { - for (auto& segment : dataSegments) { - wasm.addDataSegment(std::move(segment)); - } // now that we have names, apply things if (startIndex != static_cast<Index>(-1)) { @@ -3072,7 +3069,7 @@ void WasmBinaryBuilder::readDataSegments() { auto size = getU32LEB(); auto data = getByteView(size); curr->data = {data.first, data.second}; - dataSegments.push_back(std::move(curr)); + wasm.addDataSegment(std::move(curr)); } } @@ -3398,8 +3395,8 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < dataSegments.size()) { - dataSegments[i]->setExplicitName(name); + if (index < wasm.dataSegments.size()) { + wasm.dataSegments[i]->setExplicitName(name); } else { std::cerr << "warning: data index out of bounds in name section, " "data subsection: " |