aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-03-28 00:07:32 +0800
committerLiana Husikyan <liana@ethdev.com>2015-04-01 21:21:17 +0800
commit37a0234c4a673f130f28a3241cb72589b0aa1f47 (patch)
treeb3e89c7c2d3460ea4fa6807aa4e9c6f79ac3829c
parent4227be6e12a4b40b729457eadce681641dd738df (diff)
downloaddexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar.gz
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar.bz2
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar.lz
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar.xz
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.tar.zst
dexon-solidity-37a0234c4a673f130f28a3241cb72589b0aa1f47.zip
style fixes
-rw-r--r--AST.cpp2
-rw-r--r--Types.cpp15
2 files changed, 11 insertions, 6 deletions
diff --git a/AST.cpp b/AST.cpp
index e3c9bc96..7fe3a982 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -337,7 +337,7 @@ void FunctionDefinition::checkTypeRequirements()
{
if (!var->getType()->canLiveOutsideStorage())
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
- if (!(var->getType()->externalType()) && getVisibility() >= Visibility::Public)
+ if (getVisibility() >= Visibility::Public && !(var->getType()->externalType()))
BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility"));
}
for (ASTPointer<ModifierInvocation> const& modifier: m_functionModifiers)
diff --git a/Types.cpp b/Types.cpp
index 5fd7d24a..e784c6b8 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -1103,11 +1103,16 @@ TypePointer FunctionType::externalType() const
TypePointers paramTypes;
TypePointers retParamTypes;
- for (auto it = m_parameterTypes.cbegin(); it != m_parameterTypes.cend(); ++it)
- paramTypes.push_back((*it)->externalType());
- for (auto it = m_returnParameterTypes.cbegin(); it != m_returnParameterTypes.cend(); ++it)
- retParamTypes.push_back((*it)->externalType());
-
+ for(auto type: m_parameterTypes)
+ {
+ solAssert(!!type->externalType(), "To be included in external type of the function, the argument should have external type.");
+ paramTypes.push_back(type->externalType());
+ }
+ for(auto param: m_returnParameterTypes)
+ {
+ solAssert(!!param->externalType(), "To be included in external type of the function, the argument should have external type.");
+ retParamTypes.push_back(param->externalType());
+ }
return make_shared<FunctionType>(paramTypes, retParamTypes, m_location, m_arbitraryParameters);
}