Skip to content

Commit

Permalink
Adds a test to check_style.sh to check for spaces before colon (:) in…
Browse files Browse the repository at this point in the history
… range based for loops.
  • Loading branch information
Christian Parpart authored and chriseth committed Jun 24, 2019
1 parent 3b02848 commit 7b3aba8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions libsolidity/ast/ASTJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions scripts/check_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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))
{
Expand Down

0 comments on commit 7b3aba8

Please sign in to comment.