summaryrefslogtreecommitdiff
path: root/src/c-writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/c-writer.cc')
-rw-r--r--src/c-writer.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/c-writer.cc b/src/c-writer.cc
index 0ba530e0..d840170e 100644
--- a/src/c-writer.cc
+++ b/src/c-writer.cc
@@ -1142,8 +1142,11 @@ void CWriter::WriteElemInitializers() {
Write(";", Newline());
size_t i = 0;
- for (const Var& var : elem_segment->vars) {
- const Func* func = module_->GetFunc(var);
+ for (const ElemExpr& elem_expr : elem_segment->elem_exprs) {
+ // We don't support the bulk-memory proposal here, so we know that we
+ // don't have any passive segments (where ref.null can be used).
+ assert(elem_expr.kind == ElemExprKind::RefFunc);
+ const Func* func = module_->GetFunc(elem_expr.var);
Index func_type_index = module_->GetFuncTypeIndex(func->decl.type_var);
Write(ExternalRef(table->name), ".data[offset + ", i,