diff options
author | chriseth <chris@ethereum.org> | 2018-07-30 22:47:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 22:47:55 +0800 |
commit | 7cf5cd6050c616599d476a865b1fcfb57472ef22 (patch) | |
tree | 16d0b81f9ace5fdbc2a9dc21010ca1e89d3b2f6f | |
parent | 9d09e21b6c7662ad037de3e14dfc8f72f6d0b274 (diff) | |
parent | c2faed77054c69b8ef35b3e54a2c05acc7e93363 (diff) | |
download | dexon-solidity-7cf5cd6050c616599d476a865b1fcfb57472ef22.tar.gz dexon-solidity-7cf5cd6050c616599d476a865b1fcfb57472ef22.tar.zst dexon-solidity-7cf5cd6050c616599d476a865b1fcfb57472ef22.zip |
Merge pull request #4608 from ethereum/lll-namespace
Replace dev::eth namespace with dev::lll in LLL
-rw-r--r-- | liblll/CodeFragment.cpp | 7 | ||||
-rw-r--r-- | liblll/CodeFragment.h | 6 | ||||
-rw-r--r-- | liblll/Compiler.cpp | 8 | ||||
-rw-r--r-- | liblll/Compiler.h | 2 | ||||
-rw-r--r-- | liblll/CompilerState.cpp | 2 | ||||
-rw-r--r-- | liblll/CompilerState.h | 2 | ||||
-rw-r--r-- | liblll/Exceptions.h | 2 | ||||
-rw-r--r-- | liblll/Parser.cpp | 13 | ||||
-rw-r--r-- | liblll/Parser.h | 2 | ||||
-rw-r--r-- | lllc/main.cpp | 3 | ||||
-rw-r--r-- | test/contracts/LLL_ENS.cpp | 2 | ||||
-rw-r--r-- | test/contracts/LLL_ERC20.cpp | 2 | ||||
-rw-r--r-- | test/liblll/Compiler.cpp | 6 | ||||
-rw-r--r-- | test/liblll/ExecutionFramework.h | 2 | ||||
-rw-r--r-- | test/liblll/Parser.cpp | 4 |
15 files changed, 33 insertions, 30 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index 5c68194b..3e82889a 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -32,9 +32,10 @@ #include <libevmasm/Instruction.h> #include "CompilerState.h" #include "Parser.h" + using namespace std; using namespace dev; -using namespace dev::eth; +using namespace dev::lll; void CodeFragment::finalise(CompilerState const& _cs) { @@ -552,7 +553,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) int targetDeposit = hasDefault ? code[code.size() - 1].m_asm.deposit() : 0; // The conditions - AssemblyItems jumpTags; + eth::AssemblyItems jumpTags; for (unsigned i = 0; i < code.size() - 1; i += 2) { requireDeposit(i, 1); @@ -619,7 +620,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) requireMaxSize(3); requireDeposit(1, 1); - auto subPush = m_asm.appendSubroutine(make_shared<Assembly>(code[0].assembly(ns))); + auto subPush = m_asm.appendSubroutine(make_shared<eth::Assembly>(code[0].assembly(ns))); m_asm.append(Instruction::DUP1); if (code.size() == 3) { diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index e5cac34e..e6e4d3b6 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -31,7 +31,7 @@ namespace sp = boost::spirit; namespace dev { -namespace eth +namespace lll { struct CompilerState; @@ -47,7 +47,7 @@ public: static CodeFragment compile(std::string const& _src, CompilerState& _s, ReadCallback const& _readFile); /// Consolidates data and compiles code. - Assembly& assembly(CompilerState const& _cs) { finalise(_cs); return m_asm; } + eth::Assembly& assembly(CompilerState const& _cs) { finalise(_cs); return m_asm; } private: void finalise(CompilerState const& _cs); @@ -61,7 +61,7 @@ private: void constructOperation(sp::utree const& _t, CompilerState& _s); bool m_finalised = false; - Assembly m_asm; + eth::Assembly m_asm; ReadCallback m_readFile; }; diff --git a/liblll/Compiler.cpp b/liblll/Compiler.cpp index f2c1b0be..657f58b8 100644 --- a/liblll/Compiler.cpp +++ b/liblll/Compiler.cpp @@ -26,9 +26,9 @@ using namespace std; using namespace dev; -using namespace dev::eth; +using namespace dev::lll; -bytes dev::eth::compileLLL(string const& _src, dev::solidity::EVMVersion _evmVersion, bool _opt, std::vector<std::string>* _errors, dev::eth::ReadCallback const& _readFile) +bytes dev::lll::compileLLL(string const& _src, dev::solidity::EVMVersion _evmVersion, bool _opt, std::vector<std::string>* _errors, ReadCallback const& _readFile) { try { @@ -66,7 +66,7 @@ bytes dev::eth::compileLLL(string const& _src, dev::solidity::EVMVersion _evmVer return bytes(); } -std::string dev::eth::compileLLLToAsm(std::string const& _src, EVMVersion _evmVersion, bool _opt, std::vector<std::string>* _errors, ReadCallback const& _readFile) +std::string dev::lll::compileLLLToAsm(std::string const& _src, EVMVersion _evmVersion, bool _opt, std::vector<std::string>* _errors, ReadCallback const& _readFile) { try { @@ -103,7 +103,7 @@ std::string dev::eth::compileLLLToAsm(std::string const& _src, EVMVersion _evmVe return string(); } -string dev::eth::parseLLL(string const& _src) +string dev::lll::parseLLL(string const& _src) { sp::utree o; diff --git a/liblll/Compiler.h b/liblll/Compiler.h index 06440c17..1ff7d5f8 100644 --- a/liblll/Compiler.h +++ b/liblll/Compiler.h @@ -30,7 +30,7 @@ namespace dev { -namespace eth +namespace lll { using ReadCallback = std::function<std::string(std::string const&)>; diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp index c0e344b2..019582d4 100644 --- a/liblll/CompilerState.cpp +++ b/liblll/CompilerState.cpp @@ -24,7 +24,7 @@ using namespace std; using namespace dev; -using namespace dev::eth; +using namespace dev::lll; CompilerState::CompilerState() { diff --git a/liblll/CompilerState.h b/liblll/CompilerState.h index 96a0246d..0fa50288 100644 --- a/liblll/CompilerState.h +++ b/liblll/CompilerState.h @@ -26,7 +26,7 @@ namespace dev { -namespace eth +namespace lll { struct Macro diff --git a/liblll/Exceptions.h b/liblll/Exceptions.h index e8ca99db..7bd951e3 100644 --- a/liblll/Exceptions.h +++ b/liblll/Exceptions.h @@ -25,7 +25,7 @@ namespace dev { -namespace eth +namespace lll { /// Compile a Low-level Lisp-like Language program into EVM-code. diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp index a3962df4..506553f9 100644 --- a/liblll/Parser.cpp +++ b/liblll/Parser.cpp @@ -33,12 +33,12 @@ using namespace std; using namespace dev; -using namespace dev::eth; +using namespace dev::lll; namespace qi = boost::spirit::qi; namespace px = boost::phoenix; namespace sp = boost::spirit; -void dev::eth::killBigints(sp::utree const& _this) +void dev::lll::killBigints(sp::utree const& _this) { switch (_this.which()) { @@ -48,7 +48,7 @@ void dev::eth::killBigints(sp::utree const& _this) } } -void dev::eth::debugOutAST(ostream& _out, sp::utree const& _this) +void dev::lll::debugOutAST(ostream& _out, sp::utree const& _this) { switch (_this.which()) { @@ -74,7 +74,8 @@ void dev::eth::debugOutAST(ostream& _out, sp::utree const& _this) } } -namespace dev { namespace eth { +namespace dev { +namespace lll { namespace parseTreeLLL_ { template<unsigned N> @@ -88,11 +89,11 @@ struct tagNode }}} -void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out) +void dev::lll::parseTreeLLL(string const& _s, sp::utree& o_out) { using qi::standard::space; using qi::standard::space_type; - using dev::eth::parseTreeLLL_::tagNode; + using dev::lll::parseTreeLLL_::tagNode; using symbol_type = sp::basic_string<std::string, sp::utree_type::symbol_type>; using it = string::const_iterator; diff --git a/liblll/Parser.h b/liblll/Parser.h index 694d0cc6..cfbec418 100644 --- a/liblll/Parser.h +++ b/liblll/Parser.h @@ -31,7 +31,7 @@ namespace sp = boost::spirit; namespace dev { -namespace eth +namespace lll { void killBigints(sp::utree const& _this); diff --git a/lllc/main.cpp b/lllc/main.cpp index 0ca3ff13..f863451d 100644 --- a/lllc/main.cpp +++ b/lllc/main.cpp @@ -32,7 +32,7 @@ using namespace std; using namespace dev; using namespace dev::solidity; -using namespace dev::eth; +using namespace dev::lll; static string const VersionString = string(ETH_PROJECT_VERSION) + @@ -49,6 +49,7 @@ static void help() << " -a,--assembly Only parse and compile; show assembly." << endl << " -t,--parse-tree Only parse; show parse tree." << endl << " -o,--optimise Turn on/off the optimiser; off by default." << endl + << " -d,--disassemble Disassemble input into an opcode stream." << endl << " -h,--help Show this help message and exit." << endl << " -V,--version Show the version and exit." << endl; exit(0); diff --git a/test/contracts/LLL_ENS.cpp b/test/contracts/LLL_ENS.cpp index 3461c577..cfd6970c 100644 --- a/test/contracts/LLL_ENS.cpp +++ b/test/contracts/LLL_ENS.cpp @@ -28,7 +28,7 @@ #define ACCOUNT(n) h256(account(n), h256::AlignRight) using namespace std; -using namespace dev::eth; +using namespace dev::lll; namespace dev { diff --git a/test/contracts/LLL_ERC20.cpp b/test/contracts/LLL_ERC20.cpp index 89d1c4f0..6c6762dd 100644 --- a/test/contracts/LLL_ERC20.cpp +++ b/test/contracts/LLL_ERC20.cpp @@ -33,7 +33,7 @@ #define SUCCESS encodeArgs(1) using namespace std; -using namespace dev::eth; +using namespace dev::lll; namespace dev { diff --git a/test/liblll/Compiler.cpp b/test/liblll/Compiler.cpp index ebdea185..1e6f6d87 100644 --- a/test/liblll/Compiler.cpp +++ b/test/liblll/Compiler.cpp @@ -46,7 +46,7 @@ namespace bool successCompile(string const& _sourceCode) { vector<string> errors; - bytes bytecode = eth::compileLLL(_sourceCode, dev::test::Options::get().evmVersion(), false, &errors); + bytes bytecode = lll::compileLLL(_sourceCode, dev::test::Options::get().evmVersion(), false, &errors); if (!errors.empty()) return false; if (bytecode.empty()) @@ -358,7 +358,7 @@ BOOST_AUTO_TEST_CASE(valid_opcodes_functional) for (size_t i = 0; i < opcodes_bytecode.size(); i++) { vector<string> errors; - bytes code = eth::compileLLL(opcodes_lll[i], dev::test::Options::get().evmVersion(), false, &errors); + bytes code = lll::compileLLL(opcodes_lll[i], dev::test::Options::get().evmVersion(), false, &errors); BOOST_REQUIRE_MESSAGE(errors.empty(), opcodes_lll[i]); @@ -646,7 +646,7 @@ BOOST_AUTO_TEST_CASE(valid_opcodes_asm) for (size_t i = 0; i < opcodes_bytecode.size(); i++) { vector<string> errors; - bytes code = eth::compileLLL(opcodes_lll[i], dev::test::Options::get().evmVersion(), false, &errors); + bytes code = lll::compileLLL(opcodes_lll[i], dev::test::Options::get().evmVersion(), false, &errors); BOOST_REQUIRE_MESSAGE(errors.empty(), opcodes_lll[i]); diff --git a/test/liblll/ExecutionFramework.h b/test/liblll/ExecutionFramework.h index ae5cd988..7c1ce670 100644 --- a/test/liblll/ExecutionFramework.h +++ b/test/liblll/ExecutionFramework.h @@ -56,7 +56,7 @@ public: BOOST_REQUIRE(_libraryAddresses.empty()); std::vector<std::string> errors; - bytes bytecode = eth::compileLLL(_sourceCode, dev::test::Options::get().evmVersion(), m_optimize, &errors); + bytes bytecode = lll::compileLLL(_sourceCode, dev::test::Options::get().evmVersion(), m_optimize, &errors); if (!errors.empty()) { for (auto const& error: errors) diff --git a/test/liblll/Parser.cpp b/test/liblll/Parser.cpp index fc977b81..d343aab1 100644 --- a/test/liblll/Parser.cpp +++ b/test/liblll/Parser.cpp @@ -39,13 +39,13 @@ namespace bool successParse(std::string const& _source) { - std::string ret = eth::parseLLL(_source); + std::string ret = lll::parseLLL(_source); return ret.size() != 0; } std::string parse(std::string const& _source) { - return eth::parseLLL(_source); + return lll::parseLLL(_source); } } |