summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resolve-names.cc1
-rw-r--r--src/wast-parser.cc14
2 files changed, 12 insertions, 3 deletions
diff --git a/src/resolve-names.cc b/src/resolve-names.cc
index 1bcc52e6..0e3c70e1 100644
--- a/src/resolve-names.cc
+++ b/src/resolve-names.cc
@@ -461,6 +461,7 @@ void NameResolver::VisitDataSegment(DataSegment* segment) {
Result NameResolver::VisitModule(Module* module) {
current_module_ = module;
+ CheckDuplicateBindings(&module->elem_segment_bindings, "elem");
CheckDuplicateBindings(&module->func_bindings, "function");
CheckDuplicateBindings(&module->global_bindings, "global");
CheckDuplicateBindings(&module->func_type_bindings, "function type");
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index 517b70bc..ca21584f 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -932,9 +932,17 @@ Result WastParser::ParseElemModuleField(Module* module) {
EXPECT(Lpar);
Location loc = GetLocation();
EXPECT(Elem);
- std::string name;
- ParseBindVarOpt(&name);
- auto field = MakeUnique<ElemSegmentModuleField>(loc, name);
+ std::string segment_name;
+ ParseBindVarOpt(&segment_name);
+ // With MVP text format the name here was intended to refer to the table
+ // that the elem segment was part of, but we never did anything with this name
+ // since there was only one table anyway.
+ // With bulk-memory enabled this introduces a new name for the particualr
+ // elem segment.
+ if (!options_->features.bulk_memory_enabled()) {
+ segment_name = "";
+ }
+ auto field = MakeUnique<ElemSegmentModuleField>(loc, segment_name);
if (ParseRefTypeOpt(&field->elem_segment.elem_type)) {
field->elem_segment.passive = true;