Fix build failure.

This commit is contained in:
chriseth 2020-10-19 19:14:26 +02:00
parent 6979952995
commit 23205711b7
2 changed files with 11 additions and 5 deletions

View File

@ -145,11 +145,7 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName)
else if (EnumDefinition const* enumDef = dynamic_cast<EnumDefinition const*>(declaration))
_typeName.annotation().type = TypeProvider::enumType(*enumDef);
else if (ContractDefinition const* contract = dynamic_cast<ContractDefinition const*>(declaration))
{
if (contract->isLibrary())
m_errorReporter.typeError(1130_error, _typeName.location(), "Invalid use of a library name.");
_typeName.annotation().type = TypeProvider::contract(*contract);
}
else
{
_typeName.annotation().type = TypeProvider::emptyTuple();
@ -161,6 +157,16 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName)
}
}
void DeclarationTypeChecker::endVisit(IdentifierPath const& _path)
{
Declaration const* declaration = _path.annotation().referencedDeclaration;
solAssert(declaration, "");
if (ContractDefinition const* contract = dynamic_cast<ContractDefinition const*>(declaration))
if (contract->isLibrary())
m_errorReporter.typeError(1130_error, _path.location(), "Invalid use of a library name.");
}
bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName)
{
if (_typeName.annotation().type)
@ -402,7 +408,6 @@ bool DeclarationTypeChecker::visit(UsingForDirective const& _usingFor)
if (!library || !library->isLibrary())
m_errorReporter.fatalTypeError(4357_error, _usingFor.libraryName().location(), "Library name expected.");
_usingFor.libraryName().annotation().type = TypeProvider::contract(*library);
if (_usingFor.typeName())
_usingFor.typeName()->accept(*this);

View File

@ -54,6 +54,7 @@ private:
bool visit(ElementaryTypeName const& _typeName) override;
void endVisit(UserDefinedTypeName const& _typeName) override;
void endVisit(IdentifierPath const& _identifierPath) override;
bool visit(FunctionTypeName const& _typeName) override;
void endVisit(Mapping const& _mapping) override;
void endVisit(ArrayTypeName const& _typeName) override;