| 205 | } |
| 206 | |
| 207 | inline bool array_add_item(OutputStream* stream, |
| 208 | Serializer::GroupInfo & group_info, |
| 209 | FieldType item_type, |
| 210 | uint32_t n) { |
| 211 | if (group_info.pending_null_count) { |
| 212 | add_pending_nulls(stream, group_info); |
| 213 | } |
| 214 | if (group_info.item_type == item_type || |
| 215 | (group_info.item_type == FIELD_OBJECT && item_type == FIELD_ARRAY)) { |
| 216 | group_info.item_count += n; |
| 217 | return true; |
| 218 | } |
| 219 | if (group_info.type == FIELD_ARRAY) { |
| 220 | CHECK(false) << "Different item_type=" << type2str(item_type) |
| 221 | << " from " << group_info; |
| 222 | return false; |
| 223 | } |
| 224 | if (group_info.output_offset == 0) { |
| 225 | // Enable anynomous object at first level. |
| 226 | group_info.item_count += n; |
| 227 | return true; |
| 228 | } else { |
| 229 | CHECK(false) << "Cannot add field without name to " << group_info; |
| 230 | return false; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | //========================= |
| 235 | //adding primitive types |
no test coverage detected