Remove "using namespace" from header and move Instruction to dev::eth.

This commit is contained in:
chriseth
2019-03-28 13:48:11 +01:00
parent 77b8b4874d
commit 2308904f68
66 changed files with 190 additions and 220 deletions
@@ -33,6 +33,7 @@
#include <test/Options.h>
using namespace std;
using namespace dev::eth;
using namespace langutil;
namespace dev
+1 -1
View File
@@ -109,7 +109,7 @@ public:
bytes realCode = bytecodeSansMetadata(_bytecode);
BOOST_REQUIRE_MESSAGE(!realCode.empty(), "Invalid or missing metadata in bytecode.");
size_t instructions = 0;
solidity::eachInstruction(realCode, [&](Instruction _instr, u256 const&) {
dev::eth::eachInstruction(realCode, [&](Instruction _instr, u256 const&) {
if (!_which || *_which == _instr)
instructions++;
});
-1
View File
@@ -40,7 +40,6 @@
using namespace std;
using namespace langutil;
using namespace yul;
using namespace dev::solidity;
namespace
{
-1
View File
@@ -37,7 +37,6 @@ using namespace std;
using namespace dev;
using namespace yul;
using namespace yul::test;
using namespace dev::solidity;
namespace
{
+1 -1
View File
@@ -85,7 +85,7 @@ bool ObjectCompilerTest::run(ostream& _stream, string const& _linePrefix, bool c
"Bytecode: " +
toHex(obj.bytecode->bytecode) +
"\nOpcodes: " +
boost::trim_copy(solidity::disassemble(obj.bytecode->bytecode)) +
boost::trim_copy(dev::eth::disassemble(obj.bytecode->bytecode)) +
"\n";
if (m_expectation != m_obtainedResult)
+1 -1
View File
@@ -36,7 +36,7 @@ string assemble(string const& _input)
{
AssemblyStack asmStack;
BOOST_REQUIRE_MESSAGE(asmStack.parseAndAnalyze("", _input), "Source did not parse: " + _input);
return dev::solidity::disassemble(asmStack.assemble(AssemblyStack::Machine::EVM, true).bytecode->bytecode);
return dev::eth::disassemble(asmStack.assemble(AssemblyStack::Machine::EVM, true).bytecode->bytecode);
}
}
@@ -92,13 +92,14 @@ void copyZeroExtended(
using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
u256 EVMInstructionInterpreter::eval(
solidity::Instruction _instruction,
dev::eth::Instruction _instruction,
vector<u256> const& _arguments
)
{
using dev::solidity::Instruction;
using namespace dev::eth;
using dev::eth::Instruction;
auto info = solidity::instructionInfo(_instruction);
auto info = instructionInfo(_instruction);
yulAssert(size_t(info.args) == _arguments.size(), "");
auto const& arg = _arguments;
@@ -474,9 +475,9 @@ bool EVMInstructionInterpreter::logMemory(bool _write, u256 const& _offset, u256
return false;
}
void EVMInstructionInterpreter::logTrace(solidity::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
void EVMInstructionInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
{
logTrace(solidity::instructionInfo(_instruction).name, _arguments, _data);
logTrace(dev::eth::instructionInfo(_instruction).name, _arguments, _data);
}
void EVMInstructionInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
@@ -28,7 +28,7 @@
namespace dev
{
namespace solidity
namespace eth
{
enum class Instruction: uint8_t;
}
@@ -66,7 +66,7 @@ public:
explicit EVMInstructionInterpreter(InterpreterState& _state):
m_state(_state)
{}
dev::u256 eval(dev::solidity::Instruction _instruction, std::vector<dev::u256> const& _arguments);
dev::u256 eval(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments);
private:
/// Record a memory read in the trace. Also updates m_state.msize
@@ -78,7 +78,7 @@ private:
bool logMemory(bool _write, dev::u256 const& _offset, dev::u256 const& _size = 32, dev::bytes const& _data = {});
void logTrace(dev::solidity::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
void logTrace(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
/// Appends a log to the trace representing an instruction or similar operation by string,
/// with arguments and auxiliary data (if nonempty).
void logTrace(std::string const& _pseudoInstruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});