mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #96 from chriseth/moreASTOutput
Provide types for VariableDeclaration.
This commit is contained in:
commit
4457170ba6
@ -124,7 +124,10 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
|
|||||||
|
|
||||||
bool ASTJsonConverter::visit(VariableDeclaration const& _node)
|
bool ASTJsonConverter::visit(VariableDeclaration const& _node)
|
||||||
{
|
{
|
||||||
addJsonNode("VariableDeclaration", { make_pair("name", _node.name()) }, true);
|
addJsonNode("VariableDeclaration", {
|
||||||
|
make_pair("name", _node.name()),
|
||||||
|
make_pair("name", _node.name()),
|
||||||
|
}, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,5 +447,10 @@ string ASTJsonConverter::type(Expression const& _expression)
|
|||||||
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
|
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ASTJsonConverter::type(VariableDeclaration const& _varDecl)
|
||||||
|
{
|
||||||
|
return _varDecl.annotation().type ? _varDecl.annotation().type->toString() : "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ private:
|
|||||||
std::initializer_list<std::pair<std::string const, std::string const>> _list,
|
std::initializer_list<std::pair<std::string const, std::string const>> _list,
|
||||||
bool _hasChildren);
|
bool _hasChildren);
|
||||||
std::string type(Expression const& _expression);
|
std::string type(Expression const& _expression);
|
||||||
|
std::string type(VariableDeclaration const& _varDecl);
|
||||||
inline void goUp()
|
inline void goUp()
|
||||||
{
|
{
|
||||||
solAssert(!m_jsonNodePtrs.empty(), "Uneven json nodes stack. Internal error.");
|
solAssert(!m_jsonNodePtrs.empty(), "Uneven json nodes stack. Internal error.");
|
||||||
|
@ -105,6 +105,11 @@ bool ASTPrinter::visit(FunctionDefinition const& _node)
|
|||||||
bool ASTPrinter::visit(VariableDeclaration const& _node)
|
bool ASTPrinter::visit(VariableDeclaration const& _node)
|
||||||
{
|
{
|
||||||
writeLine("VariableDeclaration \"" + _node.name() + "\"");
|
writeLine("VariableDeclaration \"" + _node.name() + "\"");
|
||||||
|
*m_ostream << indentation() << (
|
||||||
|
_node.annotation().type ?
|
||||||
|
string(" Type: ") + _node.annotation().type->toString() :
|
||||||
|
string(" Type unknown.")
|
||||||
|
) << "\n";
|
||||||
printSourcePart(_node);
|
printSourcePart(_node);
|
||||||
return goDeeper();
|
return goDeeper();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user