mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
FunctionType also gets CanonicalSignature
- also using iterators in the signature creation function
This commit is contained in:
parent
b2aa3baded
commit
24d7bdd3a9
14
AST.cpp
14
AST.cpp
@ -114,18 +114,10 @@ std::string FunctionDefinition::getCanonicalSignature()
|
|||||||
{
|
{
|
||||||
auto parameters = getParameters();
|
auto parameters = getParameters();
|
||||||
std::string ret = getName() + "(";
|
std::string ret = getName() + "(";
|
||||||
unsigned int i = 1;
|
|
||||||
|
|
||||||
for (ASTPointer<VariableDeclaration> const& member: parameters)
|
for (auto it = parameters.cbegin(); it != parameters.cend(); ++it)
|
||||||
{
|
ret += (*it)->getType()->toString() + (it + 1 == parameters.end() ? "" : ",");
|
||||||
ret += member->getType()->toString();
|
return ret + ")";
|
||||||
if (i != parameters.size()) {
|
|
||||||
ret += ",";
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
ret += ")";
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Block::checkTypeRequirements()
|
void Block::checkTypeRequirements()
|
||||||
|
11
Types.cpp
11
Types.cpp
@ -452,6 +452,17 @@ unsigned FunctionType::getSizeOnStack() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FunctionType::getCanonicalSignature() const
|
||||||
|
{
|
||||||
|
auto parameters = getParameterTypes();
|
||||||
|
std::string ret = "NAME("; //TODO: how to get function name from FunctionType
|
||||||
|
|
||||||
|
for (auto it = parameters.cbegin(); it != parameters.cend(); ++it)
|
||||||
|
ret += (*it)->toString() + (it + 1 == m_parameterTypes.end() ? "" : ",");
|
||||||
|
|
||||||
|
return ret + ")";
|
||||||
|
}
|
||||||
|
|
||||||
bool MappingType::operator==(Type const& _other) const
|
bool MappingType::operator==(Type const& _other) const
|
||||||
{
|
{
|
||||||
if (_other.getCategory() != getCategory())
|
if (_other.getCategory() != getCategory())
|
||||||
|
1
Types.h
1
Types.h
@ -325,6 +325,7 @@ public:
|
|||||||
virtual unsigned getSizeOnStack() const override;
|
virtual unsigned getSizeOnStack() const override;
|
||||||
|
|
||||||
Location const& getLocation() const { return m_location; }
|
Location const& getLocation() const { return m_location; }
|
||||||
|
std::string getCanonicalSignature() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TypePointers m_parameterTypes;
|
TypePointers m_parameterTypes;
|
||||||
|
Loading…
Reference in New Issue
Block a user