mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add contract
This commit is contained in:
parent
d86136679a
commit
b3b72a2b91
@ -41,6 +41,7 @@
|
||||
*
|
||||
*/
|
||||
#define GENERATORLIST(MACRO, SEP, ENDSEP) \
|
||||
MACRO(ContractGenerator) SEP \
|
||||
MACRO(ImportGenerator) SEP \
|
||||
MACRO(PragmaGenerator) SEP \
|
||||
MACRO(SourceUnitGenerator) SEP \
|
||||
|
@ -134,7 +134,8 @@ void SourceUnitGenerator::setup()
|
||||
{
|
||||
addGenerators({
|
||||
{mutator->generator<ImportGenerator>(), s_maxImports},
|
||||
{mutator->generator<PragmaGenerator>(), 1}
|
||||
{mutator->generator<PragmaGenerator>(), 1},
|
||||
{mutator->generator<ContractGenerator>(), 1}
|
||||
});
|
||||
}
|
||||
|
||||
@ -184,6 +185,11 @@ string ImportGenerator::visit()
|
||||
return os.str();
|
||||
}
|
||||
|
||||
string ContractGenerator::visit()
|
||||
{
|
||||
return "contract C {}\n";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
shared_ptr<T> SolidityGenerator::generator()
|
||||
{
|
||||
|
@ -335,6 +335,16 @@ public:
|
||||
std::string name() override { return "Import generator"; }
|
||||
};
|
||||
|
||||
class ContractGenerator: public GeneratorBase
|
||||
{
|
||||
public:
|
||||
explicit ContractGenerator(std::shared_ptr<SolidityGenerator> _mutator):
|
||||
GeneratorBase(std::move(_mutator))
|
||||
{}
|
||||
std::string visit() override;
|
||||
std::string name() override { return "Contract generator"; }
|
||||
};
|
||||
|
||||
class SolidityGenerator: public std::enable_shared_from_this<SolidityGenerator>
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user