Skip to content

Commit 519e1c9

Browse files
committed
Specify namespaces
Fix references into solidity::util
1 parent a890c82 commit 519e1c9

36 files changed

+89
-87
lines changed

libsolidity/analysis/ControlFlowAnalyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod
129129
// Propagate changes to all exits and queue them for traversal, if needed.
130130
for (auto const& exit: currentNode->exits)
131131
if (
132-
auto exists = valueOrNullptr(nodeInfos, exit);
132+
auto exists = util::valueOrNullptr(nodeInfos, exit);
133133
nodeInfos[exit].propagateFrom(nodeInfo) || !exists
134134
)
135135
nodesToTraverse.insert(exit);

libsolidity/analysis/ControlFlowRevertPruner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void ControlFlowRevertPruner::run()
5757

5858
void ControlFlowRevertPruner::findRevertStates()
5959
{
60-
std::set<CFG::FunctionContractTuple> pendingFunctions = keys(m_functions);
60+
std::set<CFG::FunctionContractTuple> pendingFunctions = util::keys(m_functions);
6161
// We interrupt the search whenever we encounter a call to a function with (yet) unknown
6262
// revert behaviour. The ``wakeUp`` data structure contains information about which
6363
// searches to restart once we know about the behaviour.

libsolidity/analysis/FunctionCallGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ CallGraph FunctionCallGraphBuilder::buildDeployedGraph(
9797
// assigned to state variables and as such may be reachable after deployment as well.
9898
builder.m_currentNode = CallGraph::SpecialNode::InternalDispatch;
9999
set<CallGraph::Node, CallGraph::CompareByID> defaultNode;
100-
for (CallGraph::Node const& dispatchTarget: valueOrDefault(_creationGraph.edges, CallGraph::SpecialNode::InternalDispatch, defaultNode))
100+
for (CallGraph::Node const& dispatchTarget: util::valueOrDefault(_creationGraph.edges, CallGraph::SpecialNode::InternalDispatch, defaultNode))
101101
{
102102
solAssert(!holds_alternative<CallGraph::SpecialNode>(dispatchTarget), "");
103103
solAssert(get<CallableDeclaration const*>(dispatchTarget) != nullptr, "");

libsolidity/analysis/PostTypeChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,12 @@ struct ReservedErrorSelector: public PostTypeChecker::Checker
411411
);
412412
else
413413
{
414-
uint32_t selector = selectorFromSignature32(_error.functionType(true)->externalSignature());
414+
uint32_t selector = util::selectorFromSignature32(_error.functionType(true)->externalSignature());
415415
if (selector == 0 || ~selector == 0)
416416
m_errorReporter.syntaxError(
417417
2855_error,
418418
_error.location(),
419-
"The selector 0x" + toHex(toCompactBigEndian(selector, 4)) + " is reserved. Please rename the error to avoid the collision."
419+
"The selector 0x" + util::toHex(toCompactBigEndian(selector, 4)) + " is reserved. Please rename the error to avoid the collision."
420420
);
421421
}
422422
}

libsolidity/analysis/PostTypeContractLevelChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bool PostTypeContractLevelChecker::check(ContractDefinition const& _contract)
5252
for (ErrorDefinition const* error: _contract.interfaceErrors())
5353
{
5454
string signature = error->functionType(true)->externalSignature();
55-
uint32_t hash = selectorFromSignature32(signature);
55+
uint32_t hash = util::selectorFromSignature32(signature);
5656
// Fail if there is a different signature for the same hash.
5757
if (!errorHashes[hash].empty() && !errorHashes[hash].count(signature))
5858
{

libsolidity/analysis/TypeChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ void TypeChecker::visitManually(
659659
if (auto const* modifierContract = dynamic_cast<ContractDefinition const*>(modifierDecl->scope()))
660660
if (m_currentContract)
661661
{
662-
if (!contains(m_currentContract->annotation().linearizedBaseContracts, modifierContract))
662+
if (!util::contains(m_currentContract->annotation().linearizedBaseContracts, modifierContract))
663663
m_errorReporter.typeError(
664664
9428_error,
665665
_modifier.location(),
@@ -2137,7 +2137,7 @@ void TypeChecker::typeCheckABIEncodeCallFunction(FunctionCall const& _functionCa
21372137
functionPointerType->declaration().scope() == m_currentContract
21382138
)
21392139
msg += " Did you forget to prefix \"this.\"?";
2140-
else if (contains(
2140+
else if (util::contains(
21412141
m_currentContract->annotation().linearizedBaseContracts,
21422142
functionPointerType->declaration().scope()
21432143
) && functionPointerType->declaration().scope() != m_currentContract)

libsolidity/ast/AST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ vector<EventDefinition const*> const ContractDefinition::usedInterfaceEvents() c
221221
{
222222
solAssert(annotation().creationCallGraph.set(), "");
223223

224-
return convertContainer<std::vector<EventDefinition const*>>(
224+
return util::convertContainer<std::vector<EventDefinition const*>>(
225225
(*annotation().creationCallGraph)->emittedEvents +
226226
(*annotation().deployedCallGraph)->emittedEvents
227227
);
@@ -239,7 +239,7 @@ vector<ErrorDefinition const*> ContractDefinition::interfaceErrors(bool _require
239239
result +=
240240
(*annotation().creationCallGraph)->usedErrors +
241241
(*annotation().deployedCallGraph)->usedErrors;
242-
return convertContainer<vector<ErrorDefinition const*>>(move(result));
242+
return util::convertContainer<vector<ErrorDefinition const*>>(move(result));
243243
}
244244

245245
vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const

libsolidity/ast/ASTJsonConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ bool ASTJsonConverter::visit(EventDefinition const& _node)
505505
_attributes.emplace_back(
506506
make_pair(
507507
"eventSelector",
508-
toHex(u256(h256::Arith(util::keccak256(_node.functionType(true)->externalSignature()))))
508+
toHex(u256(util::h256::Arith(util::keccak256(_node.functionType(true)->externalSignature()))))
509509
));
510510

511511
setJsonNode(_node, "EventDefinition", std::move(_attributes));

libsolidity/codegen/CompilerContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void CompilerContext::appendInlineAssembly(
403403
{
404404
if (_insideFunction)
405405
return false;
406-
return contains(_localVariables, _identifier.name.str());
406+
return util::contains(_localVariables, _identifier.name.str());
407407
};
408408
identifierAccess.generateCode = [&](
409409
yul::Identifier const& _identifier,

libsolidity/codegen/ContractCompiler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ size_t ContractCompiler::deployLibrary(ContractDefinition const& _contract)
235235
m_context.pushSubroutineOffset(m_context.runtimeSub());
236236
// This code replaces the address added by appendDeployTimeAddress().
237237
m_context.appendInlineAssembly(
238-
Whiskers(R"(
238+
util::Whiskers(R"(
239239
{
240240
// If code starts at 11, an mstore(0) writes to the full PUSH20 plus data
241241
// without the need for a shift.
@@ -672,7 +672,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function)
672672
BOOST_THROW_EXCEPTION(
673673
StackTooDeepError() <<
674674
errinfo_sourceLocation(_function.location()) <<
675-
errinfo_comment("Stack too deep, try removing local variables.")
675+
util::errinfo_comment("Stack too deep, try removing local variables.")
676676
);
677677
while (!stackLayout.empty() && stackLayout.back() != static_cast<int>(stackLayout.size() - 1))
678678
if (stackLayout.back() < 0)
@@ -842,7 +842,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
842842
BOOST_THROW_EXCEPTION(
843843
StackTooDeepError() <<
844844
errinfo_sourceLocation(_inlineAssembly.location()) <<
845-
errinfo_comment("Stack too deep, try removing local variables.")
845+
util::errinfo_comment("Stack too deep, try removing local variables.")
846846
);
847847
_assembly.appendInstruction(dupInstruction(stackDiff));
848848
}
@@ -916,7 +916,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
916916
BOOST_THROW_EXCEPTION(
917917
StackTooDeepError() <<
918918
errinfo_sourceLocation(_inlineAssembly.location()) <<
919-
errinfo_comment("Stack too deep(" + to_string(stackDiff) + "), try removing local variables.")
919+
util::errinfo_comment("Stack too deep(" + to_string(stackDiff) + "), try removing local variables.")
920920
);
921921
_assembly.appendInstruction(swapInstruction(stackDiff));
922922
_assembly.appendInstruction(Instruction::POP);
@@ -1045,7 +1045,7 @@ void ContractCompiler::handleCatch(vector<ASTPointer<TryCatchClause>> const& _ca
10451045
solAssert(m_context.evmVersion().supportsReturndata(), "");
10461046

10471047
// stack: <selector>
1048-
m_context << Instruction::DUP1 << selectorFromSignature32("Error(string)") << Instruction::EQ;
1048+
m_context << Instruction::DUP1 << util::selectorFromSignature32("Error(string)") << Instruction::EQ;
10491049
m_context << Instruction::ISZERO;
10501050
m_context.appendConditionalJumpTo(panicTag);
10511051
m_context << Instruction::POP; // remove selector
@@ -1077,7 +1077,7 @@ void ContractCompiler::handleCatch(vector<ASTPointer<TryCatchClause>> const& _ca
10771077
solAssert(m_context.evmVersion().supportsReturndata(), "");
10781078

10791079
// stack: <selector>
1080-
m_context << selectorFromSignature32("Panic(uint256)") << Instruction::EQ;
1080+
m_context << util::selectorFromSignature32("Panic(uint256)") << Instruction::EQ;
10811081
m_context << Instruction::ISZERO;
10821082
m_context.appendConditionalJumpTo(fallbackTag);
10831083

0 commit comments

Comments
 (0)