MCPcopy Create free account
hub / github.com/argotorg/solidity / fullEncodingType

Method fullEncodingType

libsolidity/ast/Types.cpp:315–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315Type 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
342namespace
343{

Callers 9

tupleEncoderMethod · 0.80
tupleEncoderPackedMethod · 0.80
abiEncodingFunctionMethod · 0.80
encodeToMemoryMethod · 0.80
endVisitMethod · 0.80

Calls 5

interfaceTypeMethod · 0.45
encodingTypeMethod · 0.45
dataStoredInMethod · 0.45
baseTypeMethod · 0.45
isDynamicallySizedMethod · 0.45

Tested by

no test coverage detected