ast: events have FunctionType too

This commit is contained in:
Yoichi Hirai 2017-01-10 18:55:36 +01:00
parent 7fea4b7360
commit abc24420a7
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992
2 changed files with 17 additions and 8 deletions

View File

@ -274,7 +274,7 @@ TypeDeclarationAnnotation& EnumDefinition::annotation() const
return static_cast<TypeDeclarationAnnotation&>(*m_annotation); return static_cast<TypeDeclarationAnnotation&>(*m_annotation);
} }
shared_ptr<FunctionType const> FunctionDefinition::functionType(bool _internal) const shared_ptr<FunctionType> FunctionDefinition::functionType(bool _internal) const
{ {
if (_internal) if (_internal)
{ {
@ -285,7 +285,7 @@ shared_ptr<FunctionType const> FunctionDefinition::functionType(bool _internal)
case Declaration::Visibility::Private: case Declaration::Visibility::Private:
case Declaration::Visibility::Internal: case Declaration::Visibility::Internal:
case Declaration::Visibility::Public: case Declaration::Visibility::Public:
return make_shared<FunctionType const>(*this, _internal); return make_shared<FunctionType>(*this, _internal);
case Declaration::Visibility::External: case Declaration::Visibility::External:
return {}; return {};
default: default:
@ -303,7 +303,7 @@ shared_ptr<FunctionType const> FunctionDefinition::functionType(bool _internal)
return {}; return {};
case Declaration::Visibility::Public: case Declaration::Visibility::Public:
case Declaration::Visibility::External: case Declaration::Visibility::External:
return make_shared<FunctionType const>(*this, _internal); return make_shared<FunctionType>(*this, _internal);
default: default:
solAssert(false, "visibility() should not return a Visibility"); solAssert(false, "visibility() should not return a Visibility");
} }
@ -347,6 +347,14 @@ TypePointer EventDefinition::type() const
return make_shared<FunctionType>(*this); return make_shared<FunctionType>(*this);
} }
std::shared_ptr<FunctionType> EventDefinition::functionType(bool _internal) const
{
if (_internal)
return make_shared<FunctionType>(*this);
else
return {};
}
EventDefinitionAnnotation& EventDefinition::annotation() const EventDefinitionAnnotation& EventDefinition::annotation() const
{ {
if (!m_annotation) if (!m_annotation)
@ -404,7 +412,7 @@ TypePointer VariableDeclaration::type() const
return annotation().type; return annotation().type;
} }
shared_ptr<FunctionType const> VariableDeclaration::functionType(bool _internal) const shared_ptr<FunctionType> VariableDeclaration::functionType(bool _internal) const
{ {
if (_internal) if (_internal)
return {}; return {};
@ -417,7 +425,7 @@ shared_ptr<FunctionType const> VariableDeclaration::functionType(bool _internal)
return {}; return {};
case Declaration::Visibility::Public: case Declaration::Visibility::Public:
case Declaration::Visibility::External: case Declaration::Visibility::External:
return make_shared<FunctionType const>(*this); return make_shared<FunctionType>(*this);
default: default:
solAssert(false, "visibility() should not return a Visibility"); solAssert(false, "visibility() should not return a Visibility");
} }

View File

@ -173,7 +173,7 @@ public:
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
/// @returns null when it is not accessible as a function. /// @returns null when it is not accessible as a function.
virtual std::shared_ptr<FunctionType const> functionType(bool /*_internal*/) const { return {}; } virtual std::shared_ptr<FunctionType> functionType(bool /*_internal*/) const { return {}; }
protected: protected:
virtual Visibility defaultVisibility() const { return Visibility::Public; } virtual Visibility defaultVisibility() const { return Visibility::Public; }
@ -587,7 +587,7 @@ public:
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
/// @returns null when it is not accessible as a function. /// @returns null when it is not accessible as a function.
virtual std::shared_ptr<FunctionType const> functionType(bool /*_internal*/) const override; virtual std::shared_ptr<FunctionType> functionType(bool /*_internal*/) const override;
virtual FunctionDefinitionAnnotation& annotation() const override; virtual FunctionDefinitionAnnotation& annotation() const override;
@ -653,7 +653,7 @@ public:
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
/// @returns null when it is not accessible as a function. /// @returns null when it is not accessible as a function.
virtual std::shared_ptr<FunctionType const> functionType(bool /*_internal*/) const override; virtual std::shared_ptr<FunctionType> functionType(bool /*_internal*/) const override;
virtual VariableDeclarationAnnotation& annotation() const override; virtual VariableDeclarationAnnotation& annotation() const override;
@ -752,6 +752,7 @@ public:
bool isAnonymous() const { return m_anonymous; } bool isAnonymous() const { return m_anonymous; }
virtual TypePointer type() const override; virtual TypePointer type() const override;
virtual std::shared_ptr<FunctionType> functionType(bool /*_internal*/) const override;
virtual EventDefinitionAnnotation& annotation() const override; virtual EventDefinitionAnnotation& annotation() const override;