Merge pull request #7584 from ethereum/callback-context

Introduce callback context in libsolc
This commit is contained in:
Mathias L. Baumann
2019-11-26 15:29:03 +01:00
committed by GitHub
6 changed files with 17 additions and 12 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ function solcjs_test
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
# set up solc-js on the branch specified
setup master_060
setup callback-context
printLog "Updating index.js file..."
echo "require('./determinism.js');" >> test/index.js
+4 -2
View File
@@ -59,7 +59,7 @@ bool containsError(Json::Value const& _compilerResult, string const& _type, stri
Json::Value compile(string const& _input, CStyleReadFileCallback _callback = nullptr)
{
string output(solidity_compile(_input.c_str(), _callback));
string output(solidity_compile(_input.c_str(), _callback, nullptr));
Json::Value ret;
BOOST_REQUIRE(jsonParseStrict(output, ret));
solidity_free();
@@ -138,8 +138,10 @@ BOOST_AUTO_TEST_CASE(with_callback)
)";
CStyleReadFileCallback callback{
[](char const* _kind, char const* _path, char** o_contents, char** o_error)
[](void* _context, char const* _kind, char const* _path, char** o_contents, char** o_error)
{
// Passed in a nullptr in the compile() helper above.
BOOST_CHECK(_context == nullptr);
// Caller frees the pointers.
BOOST_CHECK(string(_kind) == ReadCallback::kindString(ReadCallback::Kind::ReadFile));
if (string(_path) == "found.sol")
+1 -1
View File
@@ -42,7 +42,7 @@ void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
{
if (!_quiet)
cout << "Input JSON: " << _input << endl;
string outputString(solidity_compile(_input.c_str(), nullptr));
string outputString(solidity_compile(_input.c_str(), nullptr, nullptr));
if (!_quiet)
cout << "Output JSON: " << outputString << endl;