mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace dev::eth namespace with dev::lll in LLL
This commit is contained in:
parent
705cbbc19a
commit
7c509137cf
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace eth
|
||||
namespace lll
|
||||
{
|
||||
|
||||
using ReadCallback = std::function<std::string(std::string const&)>;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::lll;
|
||||
|
||||
CompilerState::CompilerState()
|
||||
{
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace eth
|
||||
namespace lll
|
||||
{
|
||||
|
||||
struct Macro
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace eth
|
||||
namespace lll
|
||||
{
|
||||
|
||||
/// Compile a Low-level Lisp-like Language program into EVM-code.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace sp = boost::spirit;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace eth
|
||||
namespace lll
|
||||
{
|
||||
|
||||
void killBigints(sp::utree const& _this);
|
||||
|
@ -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) +
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define SUCCESS encodeArgs(1)
|
||||
|
||||
using namespace std;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::lll;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
@ -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]);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user