Adds a test to check_style.sh to check for spaces before colon (:) in range based for loops.

This commit is contained in:
Christian Parpart 2019-06-24 15:31:32 +02:00 committed by chriseth
parent 3b0284817e
commit 7b3aba81fb
3 changed files with 3 additions and 7 deletions

View File

@ -456,15 +456,13 @@ bool ASTJsonConverter::visit(ArrayTypeName const& _node)
bool ASTJsonConverter::visit(InlineAssembly const& _node)
{
Json::Value externalReferences(Json::arrayValue);
for (auto const& it : _node.annotation().externalReferences)
{
for (auto const& it: _node.annotation().externalReferences)
if (it.first)
{
Json::Value tuple(Json::objectValue);
tuple[it.first->name.str()] = inlineAssemblyIdentifierToJson(it);
externalReferences.append(tuple);
}
}
setJsonNode(_node, "InlineAssembly", {
make_pair("operations", Json::Value(yul::AsmPrinter()(_node.operations()))),
make_pair("externalReferences", std::move(externalReferences))

View File

@ -18,6 +18,7 @@ fi
FORMATERROR=$(
(
git grep -nIE "\<(if|for)\(" -- '*.h' '*.cpp' # no space after "if" or "for"
git grep -nIE "\<for\>\s*\([^=]*\>\s:\s.*\)" -- '*.h' '*.cpp' # no space before range based for-loop
git grep -nIE "\<if\>\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for"
git grep -nIE "[,\(<]\s*const " -- '*.h' '*.cpp' # const on left side of type
git grep -nIE "^\s*(static)?\s*const " -- '*.h' '*.cpp' # const on left side of type (beginning of line)

View File

@ -1102,8 +1102,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
for (auto const& sourceCode: m_sourceCodes)
asts.push_back(&m_compiler->ast(sourceCode.first));
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
for (auto const& contract : m_compiler->contractNames())
{
for (auto const& contract: m_compiler->contractNames())
if (auto const* assemblyItems = m_compiler->runtimeAssemblyItems(contract))
{
auto ret = GasEstimator::breakToStatementLevel(
@ -1114,8 +1113,6 @@ void CommandLineInterface::handleAst(string const& _argStr)
gasCosts[it.first] += it.second;
}
}
bool legacyFormat = !m_args.count(g_argAstCompactJson);
if (m_args.count(g_argOutputDir))
{