mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use empty() instead of size() == 0
This commit is contained in:
parent
4ab2e03be3
commit
fa0ce6a7e7
@ -76,7 +76,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
|
|||||||
{
|
{
|
||||||
solAssert(m_sourceUnit, "");
|
solAssert(m_sourceUnit, "");
|
||||||
vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
|
vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
|
||||||
if (literals.size() == 0)
|
if (literals.empty())
|
||||||
m_errorReporter.syntaxError(
|
m_errorReporter.syntaxError(
|
||||||
_pragma.location(),
|
_pragma.location(),
|
||||||
"Experimental feature name is missing."
|
"Experimental feature name is missing."
|
||||||
|
@ -2123,7 +2123,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
|||||||
|
|
||||||
auto& annotation = _memberAccess.annotation();
|
auto& annotation = _memberAccess.annotation();
|
||||||
|
|
||||||
if (possibleMembers.size() == 0)
|
if (possibleMembers.empty())
|
||||||
{
|
{
|
||||||
if (initialMemberCount == 0)
|
if (initialMemberCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -965,7 +965,7 @@ void ContractCompiler::popScopedVariables(ASTNode const* _node)
|
|||||||
unsigned stackDiff = m_context.stackHeight() - blockHeight;
|
unsigned stackDiff = m_context.stackHeight() - blockHeight;
|
||||||
CompilerUtils(m_context).popStackSlots(stackDiff);
|
CompilerUtils(m_context).popStackSlots(stackDiff);
|
||||||
m_scopeStackHeight[m_modifierDepth].erase(_node);
|
m_scopeStackHeight[m_modifierDepth].erase(_node);
|
||||||
if (m_scopeStackHeight[m_modifierDepth].size() == 0)
|
if (m_scopeStackHeight[m_modifierDepth].empty())
|
||||||
m_scopeStackHeight.erase(m_modifierDepth);
|
m_scopeStackHeight.erase(m_modifierDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ void SMTChecker::pushPathCondition(smt::Expression const& _e)
|
|||||||
|
|
||||||
smt::Expression SMTChecker::currentPathConditions()
|
smt::Expression SMTChecker::currentPathConditions()
|
||||||
{
|
{
|
||||||
if (m_pathConditions.size() == 0)
|
if (m_pathConditions.empty())
|
||||||
return smt::Expression(true);
|
return smt::Expression(true);
|
||||||
return m_pathConditions.back();
|
return m_pathConditions.back();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ assembly::Statement Parser::parseStatement()
|
|||||||
fatalParserError("Only one default case allowed.");
|
fatalParserError("Only one default case allowed.");
|
||||||
else if (m_scanner->currentToken() == Token::Case)
|
else if (m_scanner->currentToken() == Token::Case)
|
||||||
fatalParserError("Case not allowed after default case.");
|
fatalParserError("Case not allowed after default case.");
|
||||||
if (_switch.cases.size() == 0)
|
if (_switch.cases.empty())
|
||||||
fatalParserError("Switch statement without any cases.");
|
fatalParserError("Switch statement without any cases.");
|
||||||
_switch.location.end = _switch.cases.back().body.location.end;
|
_switch.location.end = _switch.cases.back().body.location.end;
|
||||||
return _switch;
|
return _switch;
|
||||||
|
@ -509,7 +509,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
|
|||||||
bool const compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful;
|
bool const compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful;
|
||||||
|
|
||||||
/// Inconsistent state - stop here to receive error reports from users
|
/// Inconsistent state - stop here to receive error reports from users
|
||||||
if (!compilationSuccess && (errors.size() == 0))
|
if (!compilationSuccess && errors.empty())
|
||||||
return formatFatalError("InternalCompilerError", "No error reported, but compilation failed.");
|
return formatFatalError("InternalCompilerError", "No error reported, but compilation failed.");
|
||||||
|
|
||||||
Json::Value output = Json::objectValue;
|
Json::Value output = Json::objectValue;
|
||||||
|
@ -554,7 +554,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
|
|||||||
if (m_scanner->currentToken() != Token::Identifier)
|
if (m_scanner->currentToken() != Token::Identifier)
|
||||||
fatalParserError(string("Expected identifier after ','"));
|
fatalParserError(string("Expected identifier after ','"));
|
||||||
}
|
}
|
||||||
if (members.size() == 0)
|
if (members.empty())
|
||||||
parserError({"enum with no members is not allowed."});
|
parserError({"enum with no members is not allowed."});
|
||||||
|
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
|
Loading…
Reference in New Issue
Block a user