mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
- added externalType to BooleanType.
- fixed the error message
This commit is contained in:
parent
60204d593e
commit
011d95e7e3
6
AST.cpp
6
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)
|
||||
|
@ -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();
|
||||
|
||||
|
3
Types.h
3
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(); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user