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

Function closestType

libsolidity/codegen/ExpressionCompiler.cpp:57–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55{
56
57Type const* closestType(Type const* _type, Type const* _targetType, bool _isShiftOp)
58{
59 if (_isShiftOp)
60 return _type->mobileType();
61 else if (auto const* tupleType = dynamic_cast<TupleType const*>(_type))
62 {
63 solAssert(_targetType, "");
64 TypePointers const& targetComponents = dynamic_cast<TupleType const&>(*_targetType).components();
65 solAssert(tupleType->components().size() == targetComponents.size(), "");
66 TypePointers tempComponents(targetComponents.size());
67 for (size_t i = 0; i < targetComponents.size(); ++i)
68 {
69 if (tupleType->components()[i] && targetComponents[i])
70 {
71 tempComponents[i] = closestType(tupleType->components()[i], targetComponents[i], _isShiftOp);
72 solAssert(tempComponents[i], "");
73 }
74 }
75 return TypeProvider::tuple(std::move(tempComponents));
76 }
77 else
78 return _targetType->dataStoredIn(DataLocation::Storage) ? _type->mobileType() : _targetType;
79}
80
81}
82

Callers 1

visitMethod · 0.85

Calls 3

mobileTypeMethod · 0.45
sizeMethod · 0.45
dataStoredInMethod · 0.45

Tested by

no test coverage detected