summaryrefslogtreecommitdiff
path: root/src/ir.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir.cc')
-rw-r--r--src/ir.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ir.cc b/src/ir.cc
index 12263ce7..88db7d5f 100644
--- a/src/ir.cc
+++ b/src/ir.cc
@@ -651,12 +651,10 @@ void Var::Destroy() {
uint8_t ElemSegment::GetFlags(const Module* module) const {
uint8_t flags = 0;
- bool all_ref_func = elem_type == Type::FuncRef;
-
switch (kind) {
case SegmentKind::Active: {
Index table_index = module->GetTableIndex(table_var);
- if (table_index != 0) {
+ if (elem_type != Type::FuncRef || table_index != 0) {
flags |= SegExplicitIndex;
}
break;
@@ -671,12 +669,13 @@ uint8_t ElemSegment::GetFlags(const Module* module) const {
break;
}
- all_ref_func =
- all_ref_func &&
+ bool all_ref_func =
+ elem_type == Type::FuncRef &&
std::all_of(elem_exprs.begin(), elem_exprs.end(),
[](const ExprList& elem_expr) {
return elem_expr.front().type() == ExprType::RefFunc;
});
+
if (!all_ref_func) {
flags |= SegUseElemExprs;
}