Skip to content

Commit 2783905

Browse files
authored
Merge pull request ethereum#4837 from chase1745/default-to-unspecified
Rename `Location::Default` to `Location::Unspecified`
2 parents 378f691 + 551e0bf commit 2783905

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

libsolidity/analysis/ReferencesResolver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
332332
case Location::Memory: return "\"memory\"";
333333
case Location::Storage: return "\"storage\"";
334334
case Location::CallData: return "\"calldata\"";
335-
case Location::Default: return "none";
335+
case Location::Unspecified: return "none";
336336
}
337337
return {};
338338
};
@@ -368,12 +368,12 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
368368
// Find correct data location.
369369
if (_variable.isEventParameter())
370370
{
371-
solAssert(varLoc == Location::Default, "");
371+
solAssert(varLoc == Location::Unspecified, "");
372372
typeLoc = DataLocation::Memory;
373373
}
374374
else if (_variable.isStateVariable())
375375
{
376-
solAssert(varLoc == Location::Default, "");
376+
solAssert(varLoc == Location::Unspecified, "");
377377
typeLoc = _variable.isConstant() ? DataLocation::Memory : DataLocation::Storage;
378378
}
379379
else if (
@@ -394,7 +394,7 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
394394
case Location::CallData:
395395
typeLoc = DataLocation::CallData;
396396
break;
397-
case Location::Default:
397+
case Location::Unspecified:
398398
solAssert(!_variable.hasReferenceOrMappingType(), "Data location not properly set.");
399399
}
400400

libsolidity/analysis/TypeChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
12171217
if (ref->dataStoredIn(DataLocation::Storage))
12181218
{
12191219
string errorText{"Uninitialized storage pointer."};
1220-
if (varDecl.referenceLocation() == VariableDeclaration::Location::Default)
1220+
if (varDecl.referenceLocation() == VariableDeclaration::Location::Unspecified)
12211221
errorText += " Did you mean '<type> memory " + varDecl.name() + "'?";
12221222
solAssert(m_scope, "");
12231223
m_errorReporter.declarationError(varDecl.location(), errorText);

libsolidity/ast/AST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
517517
using Location = VariableDeclaration::Location;
518518

519519
if (!hasReferenceOrMappingType() || isStateVariable() || isEventParameter())
520-
return set<Location>{ Location::Default };
520+
return set<Location>{ Location::Unspecified };
521521
else if (isStateVariable() && isConstant())
522522
return set<Location>{ Location::Memory };
523523
else if (isExternalCallableParameter())
@@ -546,7 +546,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
546546
}
547547
else
548548
// Struct members etc.
549-
return set<Location>{ Location::Default };
549+
return set<Location>{ Location::Unspecified };
550550
}
551551

552552
TypePointer VariableDeclaration::type() const

libsolidity/ast/AST.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ class FunctionDefinition: public CallableDeclaration, public Documented, public
655655
class VariableDeclaration: public Declaration
656656
{
657657
public:
658-
enum Location { Default, Storage, Memory, CallData };
658+
enum Location { Unspecified, Storage, Memory, CallData };
659659

660660
VariableDeclaration(
661661
SourceLocation const& _sourceLocation,
@@ -666,7 +666,7 @@ class VariableDeclaration: public Declaration
666666
bool _isStateVar = false,
667667
bool _isIndexed = false,
668668
bool _isConstant = false,
669-
Location _referenceLocation = Location::Default
669+
Location _referenceLocation = Location::Unspecified
670670
):
671671
Declaration(_sourceLocation, _name, _visibility),
672672
m_typeName(_type),

libsolidity/ast/ASTJsonConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ string ASTJsonConverter::location(VariableDeclaration::Location _location)
739739
{
740740
switch (_location)
741741
{
742-
case VariableDeclaration::Location::Default:
742+
case VariableDeclaration::Location::Unspecified:
743743
return "default";
744744
case VariableDeclaration::Location::Storage:
745745
return "storage";

libsolidity/parsing/Parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
564564
bool isIndexed = false;
565565
bool isDeclaredConst = false;
566566
Declaration::Visibility visibility(Declaration::Visibility::Default);
567-
VariableDeclaration::Location location = VariableDeclaration::Location::Default;
567+
VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified;
568568
ASTPointer<ASTString> identifier;
569569

570570
while (true)
@@ -592,7 +592,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
592592
isDeclaredConst = true;
593593
else if (_options.allowLocationSpecifier && Token::isLocationSpecifier(token))
594594
{
595-
if (location != VariableDeclaration::Location::Default)
595+
if (location != VariableDeclaration::Location::Unspecified)
596596
parserError(string("Location already specified."));
597597
else if (!type)
598598
parserError(string("Location specifier needs explicit type name."));

0 commit comments

Comments
 (0)