Make position optional in dev::validate

This commit is contained in:
Alex Beregszaszi 2016-11-26 15:23:32 +00:00
parent dadb4818ba
commit c01426efec
3 changed files with 8 additions and 4 deletions

View File

@ -32,4 +32,10 @@ namespace dev
/// @returns false if it is invalid and the first invalid position in invalidPosition /// @returns false if it is invalid and the first invalid position in invalidPosition
bool validate(std::string const& _input, size_t& _invalidPosition); bool validate(std::string const& _input, size_t& _invalidPosition);
inline bool validate(std::string const& _input)
{
size_t invalidPos;
return validate(_input, invalidPos);
}
} }

View File

@ -417,9 +417,8 @@ bool ASTJsonConverter::visit(ElementaryTypeNameExpression const& _node)
bool ASTJsonConverter::visit(Literal const& _node) bool ASTJsonConverter::visit(Literal const& _node)
{ {
char const* tokenString = Token::toString(_node.token()); char const* tokenString = Token::toString(_node.token());
size_t invalidPos = 0;
Json::Value value{_node.value()}; Json::Value value{_node.value()};
if (!dev::validate(_node.value(), invalidPos)) if (!dev::validate(_node.value()))
value = Json::nullValue; value = Json::nullValue;
Token::Value subdenomination = Token::Value(_node.subDenomination()); Token::Value subdenomination = Token::Value(_node.subDenomination());
addJsonNode(_node, "Literal", { addJsonNode(_node, "Literal", {

View File

@ -909,8 +909,7 @@ TypePointer StringLiteralType::mobileType() const
bool StringLiteralType::isValidUTF8() const bool StringLiteralType::isValidUTF8() const
{ {
size_t dontCare {}; return dev::validate(m_value);
return dev::validate(m_value, dontCare);
} }
shared_ptr<FixedBytesType> FixedBytesType::smallestTypeForLiteral(string const& _literal) shared_ptr<FixedBytesType> FixedBytesType::smallestTypeForLiteral(string const& _literal)