mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Review suggestions.
This commit is contained in:
parent
3a5a4c6505
commit
6093982606
@ -102,7 +102,7 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct)
|
||||
auto visitor = [&](StructDefinition const& _struct, auto& _cycleDetector, size_t _depth)
|
||||
{
|
||||
if (_depth >= 256)
|
||||
fatalDeclarationError(_struct.location(), "Struct definition exhausting cyclic dependency validator.");
|
||||
fatalDeclarationError(_struct.location(), "Struct definition exhausts cyclic dependency validator.");
|
||||
|
||||
for (ASTPointer<VariableDeclaration> const& member: _struct.members())
|
||||
{
|
||||
|
@ -617,7 +617,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
|
||||
else if (isLocalVariable())
|
||||
{
|
||||
solAssert(typeName(), "");
|
||||
auto getDataLocations = [](TypePointer _type, auto&& _recursion) -> set<Location> {
|
||||
auto dataLocations = [](TypePointer _type, auto&& _recursion) -> set<Location> {
|
||||
solAssert(_type, "Can only be called after reference resolution");
|
||||
switch (_type->category())
|
||||
{
|
||||
@ -630,7 +630,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
|
||||
return set<Location>{ Location::Memory, Location::Storage };
|
||||
}
|
||||
};
|
||||
return getDataLocations(typeName()->annotation().type, getDataLocations);
|
||||
return dataLocations(typeName()->annotation().type, dataLocations);
|
||||
}
|
||||
else
|
||||
// Struct members etc.
|
||||
|
@ -130,7 +130,11 @@ struct TypeDeclarationAnnotation: DeclarationAnnotation
|
||||
|
||||
struct StructDeclarationAnnotation: TypeDeclarationAnnotation
|
||||
{
|
||||
/// Whether the struct is recursive. Will be filled in by the DeclarationTypeChecker.
|
||||
/// Whether the struct is recursive, i.e. if the struct (recursively) contains a member that involves a struct of the same
|
||||
/// type, either in a dynamic array, as member of another struct or inside a mapping.
|
||||
/// Only cases in which the recursive occurrence is within a dynamic array or a mapping are valid, while direct
|
||||
/// recursion immediately raises an error.
|
||||
/// Will be filled in by the DeclarationTypeChecker.
|
||||
std::optional<bool> recursive;
|
||||
};
|
||||
|
||||
|
@ -257,4 +257,4 @@ contract Main {
|
||||
struct JW { int i; }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (6091-6111): Struct definition exhausting cyclic dependency validator.
|
||||
// DeclarationError: (6091-6111): Struct definition exhausts cyclic dependency validator.
|
||||
|
Loading…
Reference in New Issue
Block a user