@@ -39,19 +39,21 @@ static LogicalResult writeAttribute(Attribute attribute,
3939template <class EntryTy >
4040static void writeOptionalArrayRef (DialectBytecodeWriter &writer,
4141 ArrayRef<EntryTy> storage) {
42- if (!storage.empty ()) {
43- writer.writeOwnedBool (true );
44- writer.writeList (storage, [&](EntryTy val) {
45- if constexpr (std::is_base_of_v<Attribute, EntryTy>) {
46- (void )writer.writeOptionalAttribute (val);
47- } else if constexpr (std::is_integral_v<EntryTy>) {
48- (void )writer.writeVarInt (val);
49- } else
50- static_assert (true , " EntryTy not supported" );
51- });
52- } else {
42+ if (storage.empty ()) {
5343 writer.writeOwnedBool (false );
44+ return ;
5445 }
46+
47+ writer.writeOwnedBool (true );
48+ writer.writeList (storage, [&](EntryTy val) {
49+ if constexpr (std::is_base_of_v<Attribute, EntryTy>) {
50+ (void )writer.writeOptionalAttribute (val);
51+ } else if constexpr (std::is_integral_v<EntryTy>) {
52+ (void )writer.writeVarInt (val);
53+ } else {
54+ static_assert (true , " EntryTy not supported" );
55+ }
56+ });
5557}
5658
5759template <class EntryTy >
@@ -72,8 +74,9 @@ static LogicalResult readOptionalArrayRef(DialectBytecodeReader &reader,
7274 } else if constexpr (std::is_integral_v<EntryTy>) {
7375 if (succeeded (reader.readVarInt (temp)))
7476 return temp;
75- } else
77+ } else {
7678 static_assert (true , " EntryTy not supported" );
79+ }
7780 return failure ();
7881 };
7982
0 commit comments