LLL: change (include) to use a callback

This commit is contained in:
Alex Beregszaszi
2017-10-02 21:19:36 +01:00
parent 91b20b4bd2
commit 26f3ea8cf7
6 changed files with 31 additions and 24 deletions
+5 -4
View File
@@ -28,13 +28,14 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
bytes dev::eth::compileLLL(string const& _src, bool _opt, vector<string>* _errors)
bytes dev::eth::compileLLL(string const& _src, bool _opt, vector<string>* _errors, ReadCallback const& _readFile)
{
try
{
CompilerState cs;
cs.populateStandard();
auto assembly = CodeFragment::compile(_src, cs).assembly(cs);
auto assembly = CodeFragment::compile(_src, cs, _readFile).assembly(cs);
if (_opt)
assembly = assembly.optimise(true);
bytes ret = assembly.assemble().bytecode;
@@ -66,13 +67,13 @@ bytes dev::eth::compileLLL(string const& _src, bool _opt, vector<string>* _error
return bytes();
}
std::string dev::eth::compileLLLToAsm(std::string const& _src, bool _opt, std::vector<std::string>* _errors)
std::string dev::eth::compileLLLToAsm(std::string const& _src, bool _opt, std::vector<std::string>* _errors, ReadCallback const& _readFile)
{
try
{
CompilerState cs;
cs.populateStandard();
auto assembly = CodeFragment::compile(_src, cs).assembly(cs);
auto assembly = CodeFragment::compile(_src, cs, _readFile).assembly(cs);
if (_opt)
assembly = assembly.optimise(true);
string ret = assembly.assemblyString();