| 372 | // This saves about 240 bytes of stack space but costs 272 bytes of flash memory. |
| 373 | inline void ObjectModel::ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, |
| 374 | const ExpressionValue& val, const char *_ecv_array filter) const THROWS(GCodeException) |
| 375 | { |
| 376 | if (context.WantArrayLength() && *filter == 0) |
| 377 | { |
| 378 | ReportArrayLengthAsJson(buf, context, val); |
| 379 | } |
| 380 | else if (val.GetType() == TypeCode::ObjectModel_tc) |
| 381 | { |
| 382 | if ( (*filter != '.' && *filter != 0) // we should have reached the end of the filter or a '.', error if not |
| 383 | || val.omVal == nullptr // OM arrays may contain null entries, so we need to handle them here |
| 384 | ) |
| 385 | { |
| 386 | buf->cat("null"); |
| 387 | } |
| 388 | else |
| 389 | { |
| 390 | if (*filter == '.') |
| 391 | { |
| 392 | ++filter; |
| 393 | } |
| 394 | not_null(val.omVal)->ReportAsJson(buf, context, (val.omVal == this) ? classDescriptor : nullptr, val.param, filter); |
| 395 | } |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | ReportItemAsJsonFull(buf, context, classDescriptor, val, filter); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | // Function used for compile-time check for the correct number of entries in an object model table |
| 404 | static inline constexpr size_t ArraySum(const uint8_t *_ecv_array arr, size_t numEntries) noexcept |
nothing calls this directly
no test coverage detected