aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-03-20 20:30:00 +0800
committerLiana Husikyan <liana@ethdev.com>2015-03-25 20:59:39 +0800
commit011d95e7e348908b1027dea922a429517cdebf07 (patch)
tree01dbc166bc693e56a23e0d9bf7f83b7652483690
parent60204d593e48d2f4395a34c3e7bb010d4f40e513 (diff)
downloaddexon-solidity-011d95e7e348908b1027dea922a429517cdebf07.tar.gz
dexon-solidity-011d95e7e348908b1027dea922a429517cdebf07.tar.zst
dexon-solidity-011d95e7e348908b1027dea922a429517cdebf07.zip
- added externalType to BooleanType.
- fixed the error message
-rw-r--r--AST.cpp6
-rw-r--r--Types.cpp2
-rw-r--r--Types.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/AST.cpp b/AST.cpp
index 3ecf79eb..0827f794 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -308,8 +308,8 @@ 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::Internal)
- BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to have an external address."));
+ if (!var->getType()->externalType() && getVisibility() >= Visibility::Public)
+ BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for function with external visibility"));
}
for (ASTPointer<ModifierInvocation> const& modifier: m_functionModifiers)
modifier->checkTypeRequirements(isConstructor() ?
@@ -659,7 +659,7 @@ void MemberAccess::checkTypeRequirements()
"visible in " + type.toString()));
//todo check for visibility
// else if (!m_type->externalType())
-// BOOST_THROW_EXCEPTION(createTypeError("Type is required to have an external address."));
+// BOOST_THROW_EXCEPTION(createTypeError("Internal type not allowed for function with external visibility"));
// This should probably move somewhere else.
if (type.getCategory() == Type::Category::Struct)
diff --git a/Types.cpp b/Types.cpp
index 6fe8a641..82c28a39 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -749,7 +749,9 @@ TypePointer ArrayType::externalType() const
if (m_isByteArray)
return shared_from_this();
if (!(m_baseType->externalType()))
+ {
return TypePointer();
+ }
if (dynamic_cast<ArrayType const*>(m_baseType.get()) && m_baseType->isDynamicallySized())
return TypePointer();
diff --git a/Types.h b/Types.h
index 013c6589..5941646a 100644
--- a/Types.h
+++ b/Types.h
@@ -263,7 +263,6 @@ public:
virtual std::string toString() const override;
virtual u256 literalValue(Literal const* _literal) const override;
virtual TypePointer getRealType() const override;
- virtual TypePointer externalType() const override { return shared_from_this(); }
/// @returns the smallest integer type that can hold the value or an empty pointer if not possible.
std::shared_ptr<IntegerType const> getIntegerType() const;
@@ -298,6 +297,7 @@ public:
virtual std::string toString() const override { return "bytes" + dev::toString(m_bytes); }
virtual u256 literalValue(Literal const* _literal) const override;
+ virtual TypePointer externalType() const override { return shared_from_this(); }
int getNumBytes() const { return m_bytes; }
@@ -323,6 +323,7 @@ public:
virtual std::string toString() const override { return "bool"; }
virtual u256 literalValue(Literal const* _literal) const override;
+ virtual TypePointer externalType() const override { return shared_from_this(); }
};
/**