aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-29 23:48:39 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-30 00:12:17 +0800
commitdcd47be6ca8b408b384dca9737625873ad279464 (patch)
tree45d737437156a47b7a048a63b66425a50e84872f /AST.cpp
parent005100c4867f133e86a2675be0dd9370fed3e191 (diff)
downloaddexon-solidity-dcd47be6ca8b408b384dca9737625873ad279464.tar.gz
dexon-solidity-dcd47be6ca8b408b384dca9737625873ad279464.tar.zst
dexon-solidity-dcd47be6ca8b408b384dca9737625873ad279464.zip
Removing Function and Param Description
- Removing FunctionDescription and ParamDescription. All the data should now be in the FunctionType - Plus using the FunctionTypePointer alias in a few places
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp102
1 files changed, 2 insertions, 100 deletions
diff --git a/AST.cpp b/AST.cpp
index bd333b91..74d40da4 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -77,11 +77,11 @@ void ContractDefinition::checkTypeRequirements()
}
}
-map<FixedHash<4>, std::shared_ptr<FunctionType const>> ContractDefinition::getInterfaceFunctions() const
+map<FixedHash<4>, FunctionTypePointer> ContractDefinition::getInterfaceFunctions() const
{
auto exportedFunctionList = getInterfaceFunctionList();
- map<FixedHash<4>, std::shared_ptr<FunctionType const>> exportedFunctions;
+ map<FixedHash<4>, FunctionTypePointer> exportedFunctions;
for (auto const& it: exportedFunctionList)
// exportedFunctions.insert(make_pair(std::get<0>(it), FunctionDescription(std::get<1>(it), std::get<2>(it))));
exportedFunctions.insert(it);
@@ -520,103 +520,5 @@ void Literal::checkTypeRequirements()
BOOST_THROW_EXCEPTION(createTypeError("Invalid literal value."));
}
-std::string const& ParamDescription::getName() const
-{
- return m_description.first;
-}
-
-std::string const& ParamDescription::getType() const
-{
- return m_description.second;
-}
-
-ASTPointer<ASTString> FunctionDescription::getDocumentation() const
-{
- auto function = dynamic_cast<FunctionDefinition const*>(m_description.second);
- if (function)
- return function->getDocumentation();
-
- return ASTPointer<ASTString>();
-}
-
-string FunctionDescription::getSignature() const
-{
- return m_description.first->getCanonicalSignature(m_description.second->getName());
-}
-
-string FunctionDescription::getName() const
-{
- return m_description.second->getName();
-}
-
-bool FunctionDescription::isConstant() const
-{
- auto function = dynamic_cast<FunctionDefinition const*>(m_description.second);
- if (function)
- return function->isDeclaredConst();
-
- return true;
-}
-
-vector<ParamDescription> const FunctionDescription::getParameters() const
-{
- auto function = dynamic_cast<FunctionDefinition const*>(m_description.second);
- if (function)
- {
- vector<ParamDescription> paramsDescription;
- for (auto const& param: function->getParameters())
- paramsDescription.push_back(ParamDescription(param->getName(), param->getType()->toString()));
-
- return paramsDescription;
- }
-
- // else for now let's assume no parameters to accessors
- // LTODO: fix this for mapping types
- return {};
-}
-
-vector<ParamDescription> const FunctionDescription::getReturnParameters() const
-{
- auto function = dynamic_cast<FunctionDefinition const*>(m_description.second);
- if (function)
- {
- vector<ParamDescription> paramsDescription;
- for (auto const& param: function->getReturnParameters())
- paramsDescription.push_back(ParamDescription(param->getName(), param->getType()->toString()));
-
- return paramsDescription;
- }
-
- auto vardecl = dynamic_cast<VariableDeclaration const*>(m_description.second);
- return {ParamDescription(vardecl->getName(), vardecl->getType()->toString())};
-}
-
-Declaration const* FunctionDescription::getDeclaration() const
-{
- return m_description.second;
-}
-
-VariableDeclaration const* FunctionDescription::getVariableDeclaration() const
-{
- return dynamic_cast<VariableDeclaration const*>(m_description.second);
-}
-
-FunctionDefinition const* FunctionDescription::getFunctionDefinition() const
-{
- return dynamic_cast<FunctionDefinition const*>(m_description.second);
-}
-
-shared_ptr<FunctionType const> FunctionDescription::getFunctionTypeShared() const
-{
- return m_description.first;
-}
-
-
-FunctionType const* FunctionDescription::getFunctionType() const
-{
- return m_description.first.get();
-}
-
-
}
}