MCPcopy Create free account
hub / github.com/WebAssembly/wabt / GetFlags

Method GetFlags

src/ir.cc:707–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707uint8_t ElemSegment::GetFlags(const Module* module,
708 bool function_references_enabled) const {
709 uint8_t flags = 0;
710
711 switch (kind) {
712 case SegmentKind::Active: {
713 Index table_index = module->GetTableIndex(table_var);
714 if (elem_type != Type::FuncRef || table_index != 0) {
715 flags |= SegExplicitIndex;
716 }
717 break;
718 }
719
720 case SegmentKind::Passive:
721 flags |= SegPassive;
722 break;
723
724 case SegmentKind::Declared:
725 flags |= SegDeclared;
726 break;
727 }
728
729 if (function_references_enabled &&
730 elem_type != Type(Type::FuncRef, Type::ReferenceNonNull)) {
731 flags |= SegUseElemExprs;
732 } else {
733 bool all_ref_func =
734 elem_type == Type::FuncRef &&
735 std::all_of(elem_exprs.begin(), elem_exprs.end(),
736 [](const ExprList& elem_expr) {
737 return elem_expr.front().type() == ExprType::RefFunc;
738 });
739
740 if (!all_ref_func) {
741 flags |= SegUseElemExprs;
742 }
743 }
744
745 return flags;
746}
747
748uint8_t DataSegment::GetFlags(const Module* module) const {
749 uint8_t flags = 0;

Callers 2

WriteElemSegmentMethod · 0.80
WriteModuleMethod · 0.80

Calls 7

GetTableIndexMethod · 0.80
frontMethod · 0.80
GetMemoryIndexMethod · 0.80
TypeClass · 0.50
beginMethod · 0.45
endMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected