Skip to content

Commit 494749c

Browse files
committed
Correct group generation for the sequence
1 parent 07a1626 commit 494749c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/fast_type_gen/inl_gen.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,16 @@ void inl_gen::visit(const mfast::sequence_field_instruction *inst,
681681
for (std::size_t i = 0; i < inst->subinstructions().size(); ++i) {
682682
const field_instruction *subinst = inst->subinstructions()[i];
683683

684-
out_ << " visitor.visit(" << get_ext_cref_type(subinst) << " ((*this)["
685-
<< i << "]) );\n";
684+
if (is_group_type(subinst) && subinst->optional())
685+
{
686+
out_ << " {\n"
687+
<< " " << get_ext_cref_type(subinst) << " ext_cref_group((*this)[" << i << "]);\n"
688+
<< " ext_cref_group.set_group_present(this->field_storage(" << i << ")->is_present());\n"
689+
<< " visitor.visit(ext_cref_group);\n"
690+
<< " }\n";
691+
}
692+
else
693+
out_ << " visitor.visit(" << get_ext_cref_type(subinst) << " ((*this)[" << i << "]) );\n";
686694
}
687695

688696
out_ << "}\n\n";

0 commit comments

Comments
 (0)