| 313 | } |
| 314 | |
| 315 | Type const* Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) const |
| 316 | { |
| 317 | Type const* encodingType = mobileType(); |
| 318 | if (encodingType) |
| 319 | encodingType = encodingType->interfaceType(_inLibraryCall); |
| 320 | if (encodingType) |
| 321 | encodingType = encodingType->encodingType(); |
| 322 | // Structs are fine in the following circumstances: |
| 323 | // - ABIv2 or, |
| 324 | // - storage struct for a library |
| 325 | if (_inLibraryCall && encodingType && encodingType->dataStoredIn(DataLocation::Storage)) |
| 326 | return encodingType; |
| 327 | Type const* baseType = encodingType; |
| 328 | while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType)) |
| 329 | { |
| 330 | baseType = arrayType->baseType(); |
| 331 | |
| 332 | auto const* baseArrayType = dynamic_cast<ArrayType const*>(baseType); |
| 333 | if (!_encoderV2 && baseArrayType && baseArrayType->isDynamicallySized()) |
| 334 | return nullptr; |
| 335 | } |
| 336 | if (!_encoderV2 && dynamic_cast<StructType const*>(baseType)) |
| 337 | return nullptr; |
| 338 | |
| 339 | return encodingType; |
| 340 | } |
| 341 | |
| 342 | namespace |
| 343 | { |
no test coverage detected