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

Method sameTypeOrSubtype

libsolidity/formal/SMTEncoder.cpp:2482–2503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2480}
2481
2482bool SMTEncoder::sameTypeOrSubtype(Type const* _a, Type const* _b)
2483{
2484 bool foundSame = false;
2485
2486 solidity::util::BreadthFirstSearch<Type const*> bfs{{_a}};
2487 bfs.run([&](auto _type, auto&& _addChild) {
2488 if (*typeWithoutPointer(_b) == *typeWithoutPointer(_type))
2489 {
2490 foundSame = true;
2491 bfs.abort();
2492 }
2493 if (auto const* mapType = dynamic_cast<MappingType const*>(_type))
2494 _addChild(mapType->valueType());
2495 else if (auto const* arrayType = dynamic_cast<ArrayType const*>(_type))
2496 _addChild(arrayType->baseType());
2497 else if (auto const* structType = dynamic_cast<StructType const*>(_type))
2498 for (auto const& member: structType->nativeMembers(nullptr))
2499 _addChild(member.type);
2500 });
2501
2502 return foundSame;
2503}
2504
2505bool SMTEncoder::isSupportedType(Type const& _type) const
2506{

Callers

nothing calls this directly

Calls 5

abortMethod · 0.80
valueTypeMethod · 0.80
runMethod · 0.45
baseTypeMethod · 0.45
nativeMembersMethod · 0.45

Tested by

no test coverage detected