| 358 | } |
| 359 | |
| 360 | RationalNumberType const* TypeProvider::rationalNumber(Literal const& _literal) |
| 361 | { |
| 362 | solAssert(_literal.token() == Token::Number, ""); |
| 363 | std::tuple<bool, rational> validLiteral = RationalNumberType::isValidLiteral(_literal); |
| 364 | if (std::get<0>(validLiteral)) |
| 365 | { |
| 366 | Type const* compatibleBytesType = nullptr; |
| 367 | if (_literal.isHexNumber()) |
| 368 | { |
| 369 | size_t const digitCount = _literal.valueWithoutUnderscores().length() - 2; |
| 370 | if (digitCount % 2 == 0 && (digitCount / 2) <= 32) |
| 371 | compatibleBytesType = fixedBytes(static_cast<unsigned>(digitCount / 2)); |
| 372 | } |
| 373 | |
| 374 | return rationalNumber(std::get<1>(validLiteral), compatibleBytesType); |
| 375 | } |
| 376 | return nullptr; |
| 377 | } |
| 378 | |
| 379 | StringLiteralType const* TypeProvider::stringLiteral(std::string const& literal) |
| 380 | { |
nothing calls this directly
no test coverage detected