mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding mapping treatment to FunctionType
Plus a TypeResolution test for it
This commit is contained in:
parent
ef05913743
commit
ec7a9bf919
23
Types.cpp
23
Types.cpp
@ -621,12 +621,25 @@ FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal
|
|||||||
FunctionType::FunctionType(VariableDeclaration const& _varDecl):
|
FunctionType::FunctionType(VariableDeclaration const& _varDecl):
|
||||||
m_location(Location::EXTERNAL), m_isConstant(true), m_declaration(&_varDecl)
|
m_location(Location::EXTERNAL), m_isConstant(true), m_declaration(&_varDecl)
|
||||||
{
|
{
|
||||||
TypePointers params({});
|
TypePointers params;
|
||||||
vector<string> paramNames({});
|
vector<string> paramNames;
|
||||||
TypePointers retParams({_varDecl.getType()});
|
TypePointers retParams;
|
||||||
vector<string> retParamNames({ _varDecl.getName()});
|
vector<string> retParamNames;
|
||||||
// for now, no input parameters LTODO: change for some things like mapping
|
TypePointer varDeclType = _varDecl.getType();
|
||||||
|
auto mappingType = dynamic_cast<const MappingType*>(varDeclType.get());
|
||||||
|
if (mappingType!= nullptr)
|
||||||
|
{
|
||||||
|
params.push_back(mappingType->getKeyType());
|
||||||
|
paramNames.push_back(mappingType->getKeyType()->toString());
|
||||||
|
|
||||||
|
retParams.push_back(mappingType->getValueType());
|
||||||
|
retParamNames.push_back(mappingType->getValueType()->toString());
|
||||||
|
}
|
||||||
|
else // elelemntary type
|
||||||
|
{
|
||||||
|
retParams.push_back(varDeclType);
|
||||||
|
retParamNames.push_back(_varDecl.getName());
|
||||||
|
}
|
||||||
swap(params, m_parameterTypes);
|
swap(params, m_parameterTypes);
|
||||||
swap(paramNames, m_parameterNames);
|
swap(paramNames, m_parameterNames);
|
||||||
swap(retParams, m_returnParameterTypes);
|
swap(retParams, m_returnParameterTypes);
|
||||||
|
Loading…
Reference in New Issue
Block a user