diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-30 23:06:56 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-01 07:20:35 +0800 |
commit | ec7a9bf919c393b10a91f0bc77fe2932c66a0c6d (patch) | |
tree | 91b13616836db8252592664a99b49c5ce68eabbe /Types.cpp | |
parent | ef059137437f4d69a0888f52cb8adba975afe14f (diff) | |
download | dexon-solidity-ec7a9bf919c393b10a91f0bc77fe2932c66a0c6d.tar.gz dexon-solidity-ec7a9bf919c393b10a91f0bc77fe2932c66a0c6d.tar.zst dexon-solidity-ec7a9bf919c393b10a91f0bc77fe2932c66a0c6d.zip |
Adding mapping treatment to FunctionType
Plus a TypeResolution test for it
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -621,12 +621,25 @@ FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal FunctionType::FunctionType(VariableDeclaration const& _varDecl): m_location(Location::EXTERNAL), m_isConstant(true), m_declaration(&_varDecl) { - TypePointers params({}); - vector<string> paramNames({}); - TypePointers retParams({_varDecl.getType()}); - vector<string> retParamNames({ _varDecl.getName()}); - // for now, no input parameters LTODO: change for some things like mapping + TypePointers params; + vector<string> paramNames; + TypePointers retParams; + vector<string> retParamNames; + 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(paramNames, m_parameterNames); swap(retParams, m_returnParameterTypes); |