mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4837 from chase1745/default-to-unspecified
Rename `Location::Default` to `Location::Unspecified`
This commit is contained in:
commit
2783905bab
@ -332,7 +332,7 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
|||||||
case Location::Memory: return "\"memory\"";
|
case Location::Memory: return "\"memory\"";
|
||||||
case Location::Storage: return "\"storage\"";
|
case Location::Storage: return "\"storage\"";
|
||||||
case Location::CallData: return "\"calldata\"";
|
case Location::CallData: return "\"calldata\"";
|
||||||
case Location::Default: return "none";
|
case Location::Unspecified: return "none";
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
@ -368,12 +368,12 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
|||||||
// Find correct data location.
|
// Find correct data location.
|
||||||
if (_variable.isEventParameter())
|
if (_variable.isEventParameter())
|
||||||
{
|
{
|
||||||
solAssert(varLoc == Location::Default, "");
|
solAssert(varLoc == Location::Unspecified, "");
|
||||||
typeLoc = DataLocation::Memory;
|
typeLoc = DataLocation::Memory;
|
||||||
}
|
}
|
||||||
else if (_variable.isStateVariable())
|
else if (_variable.isStateVariable())
|
||||||
{
|
{
|
||||||
solAssert(varLoc == Location::Default, "");
|
solAssert(varLoc == Location::Unspecified, "");
|
||||||
typeLoc = _variable.isConstant() ? DataLocation::Memory : DataLocation::Storage;
|
typeLoc = _variable.isConstant() ? DataLocation::Memory : DataLocation::Storage;
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
@ -394,7 +394,7 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
|||||||
case Location::CallData:
|
case Location::CallData:
|
||||||
typeLoc = DataLocation::CallData;
|
typeLoc = DataLocation::CallData;
|
||||||
break;
|
break;
|
||||||
case Location::Default:
|
case Location::Unspecified:
|
||||||
solAssert(!_variable.hasReferenceOrMappingType(), "Data location not properly set.");
|
solAssert(!_variable.hasReferenceOrMappingType(), "Data location not properly set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,7 +1217,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
|||||||
if (ref->dataStoredIn(DataLocation::Storage))
|
if (ref->dataStoredIn(DataLocation::Storage))
|
||||||
{
|
{
|
||||||
string errorText{"Uninitialized storage pointer."};
|
string errorText{"Uninitialized storage pointer."};
|
||||||
if (varDecl.referenceLocation() == VariableDeclaration::Location::Default)
|
if (varDecl.referenceLocation() == VariableDeclaration::Location::Unspecified)
|
||||||
errorText += " Did you mean '<type> memory " + varDecl.name() + "'?";
|
errorText += " Did you mean '<type> memory " + varDecl.name() + "'?";
|
||||||
solAssert(m_scope, "");
|
solAssert(m_scope, "");
|
||||||
m_errorReporter.declarationError(varDecl.location(), errorText);
|
m_errorReporter.declarationError(varDecl.location(), errorText);
|
||||||
|
@ -517,7 +517,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
|
|||||||
using Location = VariableDeclaration::Location;
|
using Location = VariableDeclaration::Location;
|
||||||
|
|
||||||
if (!hasReferenceOrMappingType() || isStateVariable() || isEventParameter())
|
if (!hasReferenceOrMappingType() || isStateVariable() || isEventParameter())
|
||||||
return set<Location>{ Location::Default };
|
return set<Location>{ Location::Unspecified };
|
||||||
else if (isStateVariable() && isConstant())
|
else if (isStateVariable() && isConstant())
|
||||||
return set<Location>{ Location::Memory };
|
return set<Location>{ Location::Memory };
|
||||||
else if (isExternalCallableParameter())
|
else if (isExternalCallableParameter())
|
||||||
@ -546,7 +546,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Struct members etc.
|
// Struct members etc.
|
||||||
return set<Location>{ Location::Default };
|
return set<Location>{ Location::Unspecified };
|
||||||
}
|
}
|
||||||
|
|
||||||
TypePointer VariableDeclaration::type() const
|
TypePointer VariableDeclaration::type() const
|
||||||
|
@ -655,7 +655,7 @@ private:
|
|||||||
class VariableDeclaration: public Declaration
|
class VariableDeclaration: public Declaration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Location { Default, Storage, Memory, CallData };
|
enum Location { Unspecified, Storage, Memory, CallData };
|
||||||
|
|
||||||
VariableDeclaration(
|
VariableDeclaration(
|
||||||
SourceLocation const& _sourceLocation,
|
SourceLocation const& _sourceLocation,
|
||||||
@ -666,7 +666,7 @@ public:
|
|||||||
bool _isStateVar = false,
|
bool _isStateVar = false,
|
||||||
bool _isIndexed = false,
|
bool _isIndexed = false,
|
||||||
bool _isConstant = false,
|
bool _isConstant = false,
|
||||||
Location _referenceLocation = Location::Default
|
Location _referenceLocation = Location::Unspecified
|
||||||
):
|
):
|
||||||
Declaration(_sourceLocation, _name, _visibility),
|
Declaration(_sourceLocation, _name, _visibility),
|
||||||
m_typeName(_type),
|
m_typeName(_type),
|
||||||
|
@ -739,7 +739,7 @@ string ASTJsonConverter::location(VariableDeclaration::Location _location)
|
|||||||
{
|
{
|
||||||
switch (_location)
|
switch (_location)
|
||||||
{
|
{
|
||||||
case VariableDeclaration::Location::Default:
|
case VariableDeclaration::Location::Unspecified:
|
||||||
return "default";
|
return "default";
|
||||||
case VariableDeclaration::Location::Storage:
|
case VariableDeclaration::Location::Storage:
|
||||||
return "storage";
|
return "storage";
|
||||||
|
@ -564,7 +564,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
|||||||
bool isIndexed = false;
|
bool isIndexed = false;
|
||||||
bool isDeclaredConst = false;
|
bool isDeclaredConst = false;
|
||||||
Declaration::Visibility visibility(Declaration::Visibility::Default);
|
Declaration::Visibility visibility(Declaration::Visibility::Default);
|
||||||
VariableDeclaration::Location location = VariableDeclaration::Location::Default;
|
VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified;
|
||||||
ASTPointer<ASTString> identifier;
|
ASTPointer<ASTString> identifier;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@ -592,7 +592,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
|||||||
isDeclaredConst = true;
|
isDeclaredConst = true;
|
||||||
else if (_options.allowLocationSpecifier && Token::isLocationSpecifier(token))
|
else if (_options.allowLocationSpecifier && Token::isLocationSpecifier(token))
|
||||||
{
|
{
|
||||||
if (location != VariableDeclaration::Location::Default)
|
if (location != VariableDeclaration::Location::Unspecified)
|
||||||
parserError(string("Location already specified."));
|
parserError(string("Location already specified."));
|
||||||
else if (!type)
|
else if (!type)
|
||||||
parserError(string("Location specifier needs explicit type name."));
|
parserError(string("Location specifier needs explicit type name."));
|
||||||
|
Loading…
Reference in New Issue
Block a user