Moved storage size assert to TypeChecker from DeclarationTypeChecker

This commit is contained in:
hrkrshnn
2021-10-26 18:43:04 +02:00
parent 453f404f8f
commit 9428dbc94f
5 changed files with 15 additions and 1 deletions
@@ -289,7 +289,6 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName)
return;
}
solAssert(baseType->storageBytes() != 0, "Illegal base type of storage size zero for array.");
if (Expression const* length = _typeName.length())
{
optional<rational> lengthValue;
+8
View File
@@ -1220,6 +1220,14 @@ void TypeChecker::endVisit(RevertStatement const& _revert)
m_errorReporter.typeError(1885_error, errorCall.expression().location(), "Expression has to be an error.");
}
void TypeChecker::endVisit(ArrayTypeName const& _typeName)
{
solAssert(
_typeName.baseType().annotation().type &&
_typeName.baseType().annotation().type->storageBytes() != 0,
"Illegal base type of storage size zero for array."
);
}
bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
{
+1
View File
@@ -119,6 +119,7 @@ private:
void endVisit(InheritanceSpecifier const& _inheritance) override;
void endVisit(ModifierDefinition const& _modifier) override;
bool visit(FunctionDefinition const& _function) override;
void endVisit(ArrayTypeName const& _typeName) override;
bool visit(VariableDeclaration const& _variable) override;
/// We need to do this manually because we want to pass the bases of the current contract in
/// case this is a base constructor call.