mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Restrict usage of plain "new".
This commit is contained in:
+1
-1
@@ -96,7 +96,7 @@ int registerTests(
|
||||
{
|
||||
static vector<unique_ptr<string>> filenames;
|
||||
|
||||
filenames.emplace_back(new string(_path.string()));
|
||||
filenames.emplace_back(make_unique<string>(_path.string()));
|
||||
_suite.add(make_test_case(
|
||||
[config, _testCaseCreator]
|
||||
{
|
||||
|
||||
@@ -223,7 +223,7 @@ protected:
|
||||
void deployRegistrar()
|
||||
{
|
||||
if (!s_compiledRegistrar)
|
||||
s_compiledRegistrar.reset(new bytes(compileContract(registrarCode, "GlobalRegistrar")));
|
||||
s_compiledRegistrar = make_unique<bytes>(compileContract(registrarCode, "GlobalRegistrar"));
|
||||
|
||||
sendMessage(*s_compiledRegistrar, true);
|
||||
BOOST_REQUIRE(m_transactionSuccessful);
|
||||
|
||||
@@ -132,7 +132,7 @@ protected:
|
||||
void deployRegistrar()
|
||||
{
|
||||
if (!s_compiledRegistrar)
|
||||
s_compiledRegistrar.reset(new bytes(compileContract(registrarCode, "FixedFeeRegistrar")));
|
||||
s_compiledRegistrar = make_unique<bytes>(compileContract(registrarCode, "FixedFeeRegistrar"));
|
||||
|
||||
sendMessage(*s_compiledRegistrar, true);
|
||||
BOOST_REQUIRE(m_transactionSuccessful);
|
||||
|
||||
@@ -448,7 +448,7 @@ protected:
|
||||
)
|
||||
{
|
||||
if (!s_compiledWallet)
|
||||
s_compiledWallet.reset(new bytes(compileContract(walletCode, "Wallet")));
|
||||
s_compiledWallet = make_unique<bytes>(compileContract(walletCode, "Wallet"));
|
||||
|
||||
bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners);
|
||||
sendMessage(*s_compiledWallet + args, true, _value);
|
||||
|
||||
@@ -36,7 +36,7 @@ class ABIJsonTest: public TestCase
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{ return std::unique_ptr<TestCase>(new ABIJsonTest(_config.filename)); }
|
||||
{ return std::make_unique<ABIJsonTest>(_config.filename); }
|
||||
ABIJsonTest(std::string const& _filename);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||
|
||||
@@ -36,7 +36,7 @@ class ASTJSONTest: public TestCase
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{ return std::unique_ptr<TestCase>(new ASTJSONTest(_config.filename)); }
|
||||
{ return std::make_unique<ASTJSONTest>(_config.filename); }
|
||||
ASTJSONTest(std::string const& _filename);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||
|
||||
@@ -37,7 +37,7 @@ class EWasmTranslationTest: public dev::solidity::test::EVMVersionRestrictedTest
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{
|
||||
return std::unique_ptr<TestCase>(new EWasmTranslationTest(_config.filename));
|
||||
return std::make_unique<EWasmTranslationTest>(_config.filename);
|
||||
}
|
||||
|
||||
explicit EWasmTranslationTest(std::string const& _filename);
|
||||
|
||||
@@ -34,7 +34,7 @@ class FunctionSideEffects: public dev::solidity::test::TestCase
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{ return std::unique_ptr<TestCase>(new FunctionSideEffects(_config.filename)); }
|
||||
{ return std::make_unique<FunctionSideEffects>(_config.filename); }
|
||||
explicit FunctionSideEffects(std::string const& _filename);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ObjectCompilerTest: public dev::solidity::test::TestCase
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{
|
||||
return std::unique_ptr<TestCase>(new ObjectCompilerTest(_config.filename));
|
||||
return std::make_unique<ObjectCompilerTest>(_config.filename);
|
||||
}
|
||||
|
||||
explicit ObjectCompilerTest(std::string const& _filename);
|
||||
|
||||
@@ -42,7 +42,7 @@ class YulInterpreterTest: public dev::solidity::test::EVMVersionRestrictedTestCa
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{
|
||||
return std::unique_ptr<TestCase>(new YulInterpreterTest(_config.filename));
|
||||
return std::make_unique<YulInterpreterTest>(_config.filename);
|
||||
}
|
||||
|
||||
explicit YulInterpreterTest(std::string const& _filename);
|
||||
|
||||
@@ -424,7 +424,11 @@ void YulOptimizerTest::disambiguate()
|
||||
void YulOptimizerTest::updateContext()
|
||||
{
|
||||
m_nameDispenser = make_unique<NameDispenser>(*m_dialect, *m_ast, m_reservedIdentifiers);
|
||||
m_context = unique_ptr<OptimiserStepContext>(new OptimiserStepContext{*m_dialect, *m_nameDispenser, m_reservedIdentifiers});
|
||||
m_context = make_unique<OptimiserStepContext>(OptimiserStepContext{
|
||||
*m_dialect,
|
||||
*m_nameDispenser,
|
||||
m_reservedIdentifiers
|
||||
});
|
||||
}
|
||||
|
||||
void YulOptimizerTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
||||
|
||||
@@ -51,7 +51,7 @@ class YulOptimizerTest: public dev::solidity::test::EVMVersionRestrictedTestCase
|
||||
public:
|
||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||
{
|
||||
return std::unique_ptr<TestCase>(new YulOptimizerTest(_config.filename));
|
||||
return std::make_unique<YulOptimizerTest>(_config.filename);
|
||||
}
|
||||
|
||||
explicit YulOptimizerTest(std::string const& _filename);
|
||||
|
||||
Reference in New Issue
Block a user