diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binary-writer.cc | 26 | ||||
-rw-r--r-- | src/binary.h | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/binary-writer.cc b/src/binary-writer.cc index 6c0a73db..e5c9c4d2 100644 --- a/src/binary-writer.cc +++ b/src/binary-writer.cc @@ -1011,6 +1011,19 @@ Result BinaryWriter::WriteModule() { EndSection(); } + assert(module_->events.size() >= module_->num_event_imports); + Index num_events = module_->events.size() - module_->num_event_imports; + if (num_events) { + BeginKnownSection(BinarySection::Event); + WriteU32Leb128(stream_, num_events, "event count"); + for (size_t i = 0; i < num_events; ++i) { + WriteHeader("event", i); + const Event* event = module_->events[i + module_->num_event_imports]; + WriteEventType(event); + } + EndSection(); + } + assert(module_->globals.size() >= module_->num_global_imports); Index num_globals = module_->globals.size() - module_->num_global_imports; if (num_globals) { @@ -1025,19 +1038,6 @@ Result BinaryWriter::WriteModule() { EndSection(); } - assert(module_->events.size() >= module_->num_event_imports); - Index num_events = module_->events.size() - module_->num_event_imports; - if (num_events) { - BeginKnownSection(BinarySection::Event); - WriteU32Leb128(stream_, num_events, "event count"); - for (size_t i = 0; i < num_events; ++i) { - WriteHeader("event", i); - const Event* event = module_->events[i + module_->num_event_imports]; - WriteEventType(event); - } - EndSection(); - } - if (module_->exports.size()) { BeginKnownSection(BinarySection::Export); WriteU32Leb128(stream_, module_->exports.size(), "num exports"); diff --git a/src/binary.h b/src/binary.h index 01c9b95a..a1fc555f 100644 --- a/src/binary.h +++ b/src/binary.h @@ -36,8 +36,8 @@ V(Function, function, 3) \ V(Table, table, 4) \ V(Memory, memory, 5) \ - V(Global, global, 6) \ V(Event, event, 13) \ + V(Global, global, 6) \ V(Export, export, 7) \ V(Start, start, 8) \ V(Elem, elem, 9) \ |