mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Creating the canonical signature of a function, for later use in the ABI
This commit is contained in:
parent
ca733fd319
commit
5e875ee072
17
AST.cpp
17
AST.cpp
@ -110,6 +110,23 @@ void FunctionDefinition::checkTypeRequirements()
|
|||||||
m_body->checkTypeRequirements();
|
m_body->checkTypeRequirements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FunctionDefinition::getCanonicalSignature()
|
||||||
|
{
|
||||||
|
auto parameters = getParameters();
|
||||||
|
std::string ret = getName() + "(";
|
||||||
|
unsigned int i = 1;
|
||||||
|
|
||||||
|
for (ASTPointer<VariableDeclaration> const& member: parameters)
|
||||||
|
{
|
||||||
|
ret += member->getType()->toString();
|
||||||
|
if (i != parameters.size()) {
|
||||||
|
ret += ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret += ")";
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void Block::checkTypeRequirements()
|
void Block::checkTypeRequirements()
|
||||||
{
|
{
|
||||||
for (shared_ptr<Statement> const& statement: m_statements)
|
for (shared_ptr<Statement> const& statement: m_statements)
|
||||||
|
6
AST.h
6
AST.h
@ -277,6 +277,12 @@ public:
|
|||||||
/// Checks that all parameters have allowed types and calls checkTypeRequirements on the body.
|
/// Checks that all parameters have allowed types and calls checkTypeRequirements on the body.
|
||||||
void checkTypeRequirements();
|
void checkTypeRequirements();
|
||||||
|
|
||||||
|
/// Returns the canonical signature of the function
|
||||||
|
/// That consists of the name of the function followed by the
|
||||||
|
/// types of the arguments separated by commas all enclosed in parentheses
|
||||||
|
/// without any spaces
|
||||||
|
std::string getCanonicalSignature();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isPublic;
|
bool m_isPublic;
|
||||||
ASTPointer<ParameterList> m_parameters;
|
ASTPointer<ParameterList> m_parameters;
|
||||||
|
Loading…
Reference in New Issue
Block a user