mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fix Literalprint
This commit is contained in:
parent
254b55728f
commit
597bf8a43d
@ -704,13 +704,13 @@ 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());
|
string tokenString = tokenKind(_node.token());
|
||||||
Json::Value value{_node.value()};
|
Json::Value value{_node.value()};
|
||||||
if (!dev::validateUTF8(_node.value()))
|
if (!dev::validateUTF8(_node.value()))
|
||||||
value = Json::nullValue;
|
value = Json::nullValue;
|
||||||
Token::Value subdenomination = Token::Value(_node.subDenomination());
|
Token::Value subdenomination = Token::Value(_node.subDenomination());
|
||||||
std::vector<pair<string, Json::Value>> attributes = {
|
std::vector<pair<string, Json::Value>> attributes = {
|
||||||
make_pair("token", tokenString ? tokenString : Json::Value()),
|
make_pair(m_legacy ? "token" : "kind", tokenString),
|
||||||
make_pair("value", value),
|
make_pair("value", value),
|
||||||
make_pair(m_legacy ? "hexvalue" : "hexValue", toHex(_node.value())),
|
make_pair(m_legacy ? "hexvalue" : "hexValue", toHex(_node.value())),
|
||||||
make_pair(
|
make_pair(
|
||||||
@ -793,6 +793,23 @@ string ASTJsonConverter::functionCallKind(FunctionCallKind _kind)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ASTJsonConverter::tokenKind(Token::Value _token)
|
||||||
|
{
|
||||||
|
switch (_token)
|
||||||
|
{
|
||||||
|
case dev::solidity::Token::Number:
|
||||||
|
return "number";
|
||||||
|
case dev::solidity::Token::StringLiteral:
|
||||||
|
return "string";
|
||||||
|
case dev::solidity::Token::TrueLiteral:
|
||||||
|
return "bool";
|
||||||
|
case dev::solidity::Token::FalseLiteral:
|
||||||
|
return "bool";
|
||||||
|
default:
|
||||||
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown kind of literal token."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string ASTJsonConverter::type(Expression const& _expression)
|
string ASTJsonConverter::type(Expression const& _expression)
|
||||||
{
|
{
|
||||||
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
|
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
|
||||||
|
@ -133,6 +133,7 @@ private:
|
|||||||
std::string location(VariableDeclaration::Location _location);
|
std::string location(VariableDeclaration::Location _location);
|
||||||
std::string contractKind(ContractDefinition::ContractKind _kind);
|
std::string contractKind(ContractDefinition::ContractKind _kind);
|
||||||
std::string functionCallKind(FunctionCallKind _kind);
|
std::string functionCallKind(FunctionCallKind _kind);
|
||||||
|
std::string tokenKind(Token::Value _token);
|
||||||
std::string type(Expression const& _expression);
|
std::string type(Expression const& _expression);
|
||||||
std::string type(VariableDeclaration const& _varDecl);
|
std::string type(VariableDeclaration const& _varDecl);
|
||||||
int nodeId(ASTNode const& _node)
|
int nodeId(ASTNode const& _node)
|
||||||
|
Loading…
Reference in New Issue
Block a user