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

Method assertDetails

liblangutil/Token.cpp:70–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void ElementaryTypeNameToken::assertDetails(Token _baseType, unsigned const& _first, unsigned const& _second)
71{
72 solAssert(TokenTraits::isElementaryTypeName(_baseType), "Expected elementary type name: " + std::string(TokenTraits::toString(_baseType)));
73 if (_baseType == Token::BytesM)
74 {
75 solAssert(_second == 0, "There should not be a second size argument to type bytesM.");
76 solAssert(_first <= 32, "No elementary type bytes" + std::to_string(_first) + ".");
77 }
78 else if (_baseType == Token::UIntM || _baseType == Token::IntM)
79 {
80 solAssert(_second == 0, "There should not be a second size argument to type " + std::string(TokenTraits::toString(_baseType)) + ".");
81 solAssert(
82 _first <= 256 && _first % 8 == 0,
83 "No elementary type " + std::string(TokenTraits::toString(_baseType)) + std::to_string(_first) + "."
84 );
85 }
86 else if (_baseType == Token::UFixedMxN || _baseType == Token::FixedMxN)
87 {
88 solAssert(
89 _first >= 8 && _first <= 256 && _first % 8 == 0 && _second <= 80,
90 "No elementary type " + std::string(TokenTraits::toString(_baseType)) + std::to_string(_first) + "x" + std::to_string(_second) + "."
91 );
92 }
93 else
94 solAssert(_first == 0 && _second == 0, "Unexpected size arguments");
95
96 m_token = _baseType;
97 m_firstNumber = _first;
98 m_secondNumber = _second;
99}
100
101namespace TokenTraits
102{

Callers

nothing calls this directly

Calls 3

isElementaryTypeNameFunction · 0.85
toStringFunction · 0.70
to_stringFunction · 0.70

Tested by

no test coverage detected