aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/Types.cpp b/Types.cpp
index d5b00163..c5f1a3ae 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -489,7 +489,7 @@ MemberList const& ContractType::getMembers() const
map<string, shared_ptr<Type const>> members(IntegerType::AddressMemberList.begin(),
IntegerType::AddressMemberList.end());
for (auto const& it: m_contract.getInterfaceFunctions())
- members[it.second.second->getName()] = make_shared<FunctionType>(*it.second.second, false);
+ members[it.second.getName()] = it.second.getFunctionTypeShared();
m_members.reset(new MemberList(members));
}
return *m_members;
@@ -511,9 +511,9 @@ shared_ptr<FunctionType const> const& ContractType::getConstructorType() const
u256 ContractType::getFunctionIdentifier(string const& _functionName) const
{
auto interfaceFunctions = m_contract.getInterfaceFunctions();
- for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it)
- if (it->second.second->getName() == _functionName)
- return FixedHash<4>::Arith(it->first);
+ for (auto const& it: m_contract.getInterfaceFunctions())
+ if (it.second.getName() == _functionName)
+ return FixedHash<4>::Arith(it.first);
return Invalid256;
}
@@ -582,28 +582,47 @@ FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal
m_location(_isInternal ? Location::INTERNAL : Location::EXTERNAL)
{
TypePointers params;
+ vector<string> paramNames;
TypePointers retParams;
+ vector<string> retParamNames;
params.reserve(_function.getParameters().size());
+ paramNames.reserve(_function.getParameters().size());
for (ASTPointer<VariableDeclaration> const& var: _function.getParameters())
+ {
+ paramNames.push_back(var->getName());
params.push_back(var->getType());
+ }
retParams.reserve(_function.getReturnParameters().size());
+ retParamNames.reserve(_function.getReturnParameters().size());
for (ASTPointer<VariableDeclaration> const& var: _function.getReturnParameters())
+ {
+ retParamNames.push_back(var->getName());
retParams.push_back(var->getType());
+ }
swap(params, m_parameterTypes);
+ swap(paramNames, m_parameterNames);
swap(retParams, m_returnParameterTypes);
+ swap(retParamNames, m_returnParameterNames);
}
FunctionType::FunctionType(VariableDeclaration const& _varDecl):
m_location(Location::INTERNAL)
{
TypePointers params;
+ vector<string> paramNames;
TypePointers retParams;
+ vector<string> retParamNames;
// for now, no input parameters LTODO: change for some things like mapping
params.reserve(0);
+ paramNames.reserve(0);
retParams.reserve(1);
+ retParamNames.reserve(1);
retParams.push_back(_varDecl.getType());
+ retParamNames.push_back(_varDecl.getName());
swap(params, m_parameterTypes);
+ swap(paramNames, m_parameterNames);
swap(retParams, m_returnParameterTypes);
+ swap(retParamNames, m_returnParameterNames);
}
bool FunctionType::operator==(Type const& _other) const