mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add exports
This commit is contained in:
parent
6d2c990117
commit
a4504b286d
@ -30,6 +30,7 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
#include <range/v3/view/filter.hpp>
|
||||||
|
|
||||||
namespace solidity::test::fuzzer::mutator
|
namespace solidity::test::fuzzer::mutator
|
||||||
{
|
{
|
||||||
@ -112,20 +113,26 @@ struct ContractState
|
|||||||
std::shared_ptr<UniformRandomDistribution> uRandDist;
|
std::shared_ptr<UniformRandomDistribution> uRandDist;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Type {};
|
||||||
|
struct FunctionType: Type
|
||||||
|
{
|
||||||
|
std::vector<Type> inputs;
|
||||||
|
std::vector<Type> outputs;
|
||||||
|
};
|
||||||
|
|
||||||
struct SourceState
|
struct SourceState
|
||||||
{
|
{
|
||||||
explicit SourceState(std::shared_ptr<UniformRandomDistribution> _urd):
|
explicit SourceState(std::shared_ptr<UniformRandomDistribution> _urd):
|
||||||
uRandDist(std::move(_urd)),
|
uRandDist(std::move(_urd)),
|
||||||
importedSources({}),
|
importedSources({})
|
||||||
freeFunctions({})
|
|
||||||
{}
|
{}
|
||||||
void addFreeFunction(std::string& _functionName)
|
void addFreeFunction(std::string& _functionName)
|
||||||
{
|
{
|
||||||
freeFunctions.emplace(_functionName);
|
exports[std::make_shared<FunctionType>()] = _functionName;
|
||||||
}
|
}
|
||||||
bool freeFunction(std::string const& _functionName)
|
bool freeFunction(std::string const& _functionName)
|
||||||
{
|
{
|
||||||
return freeFunctions.count(_functionName);
|
return !(exports | ranges::views::filter([&_functionName](auto& _p) { return _p.second == _functionName; })).empty();
|
||||||
}
|
}
|
||||||
void addImportedSourcePath(std::string& _sourcePath)
|
void addImportedSourcePath(std::string& _sourcePath)
|
||||||
{
|
{
|
||||||
@ -143,7 +150,7 @@ struct SourceState
|
|||||||
void print(std::ostream& _os) const;
|
void print(std::ostream& _os) const;
|
||||||
std::shared_ptr<UniformRandomDistribution> uRandDist;
|
std::shared_ptr<UniformRandomDistribution> uRandDist;
|
||||||
std::set<std::string> importedSources;
|
std::set<std::string> importedSources;
|
||||||
std::set<std::string> freeFunctions;
|
std::map<std::shared_ptr<Type>, std::string> exports;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FunctionState {};
|
struct FunctionState {};
|
||||||
|
Loading…
Reference in New Issue
Block a user