mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7584 from ethereum/callback-context
Introduce callback context in libsolc
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user