mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
FunctionType now returns const ref for Declaration
This commit is contained in:
parent
04190798eb
commit
3701543ae8
@ -164,7 +164,7 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
|
||||
m_context << callDataUnpackerEntryPoints.at(it.first);
|
||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||
appendCalldataUnpacker(functionType->getParameterTypes());
|
||||
m_context.appendJumpTo(m_context.getFunctionEntryLabel(*it.second->getDeclaration()));
|
||||
m_context.appendJumpTo(m_context.getFunctionEntryLabel(it.second->getDeclaration()));
|
||||
m_context << returnTag;
|
||||
appendReturnValuePacker(functionType->getReturnParameterTypes());
|
||||
}
|
||||
|
@ -59,9 +59,7 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
|
||||
}
|
||||
return params;
|
||||
};
|
||||
|
||||
solAssert(it.second->getDeclaration(), "All function interface types should contain a declaration");
|
||||
method["name"] = it.second->getDeclaration()->getName();
|
||||
method["name"] = it.second->getDeclaration().getName();
|
||||
method["constant"] = it.second->isConstant();
|
||||
method["inputs"] = populateParameters(it.second->getParameterNames(),
|
||||
it.second->getParameterTypeNames());
|
||||
@ -86,7 +84,7 @@ unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition
|
||||
r += (r.size() ? "," : "(") + _paramTypes[i] + " " + _paramNames[i];
|
||||
return r.size() ? r + ")" : "()";
|
||||
};
|
||||
ret += "function " + it.second->getDeclaration()->getName() +
|
||||
ret += "function " + it.second->getDeclaration().getName() +
|
||||
populateParameters(it.second->getParameterNames(), it.second->getParameterTypeNames()) +
|
||||
(it.second->isConstant() ? "constant " : "");
|
||||
if (it.second->getReturnParameterTypes().size())
|
||||
|
@ -499,7 +499,7 @@ MemberList const& ContractType::getMembers() const
|
||||
}
|
||||
else
|
||||
for (auto const& it: m_contract.getInterfaceFunctions())
|
||||
members[it.second->getDeclaration()->getName()] = it.second;
|
||||
members[it.second->getDeclaration().getName()] = it.second;
|
||||
m_members.reset(new MemberList(members));
|
||||
}
|
||||
return *m_members;
|
||||
@ -522,7 +522,7 @@ u256 ContractType::getFunctionIdentifier(string const& _functionName) const
|
||||
{
|
||||
auto interfaceFunctions = m_contract.getInterfaceFunctions();
|
||||
for (auto const& it: m_contract.getInterfaceFunctions())
|
||||
if (it.second->getDeclaration()->getName() == _functionName)
|
||||
if (it.second->getDeclaration().getName() == _functionName)
|
||||
return FixedHash<4>::Arith(it.first);
|
||||
|
||||
return Invalid256;
|
||||
|
7
Types.h
7
Types.h
@ -390,7 +390,12 @@ public:
|
||||
/// If @a _name is not provided (empty string) then the @c m_declaration member of the
|
||||
/// function type is used
|
||||
std::string getCanonicalSignature(std::string const& _name = "") const;
|
||||
Declaration const* getDeclaration() const { return m_declaration; }
|
||||
Declaration const& getDeclaration() const
|
||||
{
|
||||
solAssert(m_declaration, "Requested declaration from a FunctionType that has none");
|
||||
return *m_declaration;
|
||||
}
|
||||
bool hasDeclaration() const { return !!m_declaration; }
|
||||
bool isConstant() const { return m_isConstant; }
|
||||
/// @return A shared pointer of an ASTString.
|
||||
/// Can contain a nullptr in which case indicates absence of documentation
|
||||
|
Loading…
Reference in New Issue
Block a user