mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Apply modernize-use-emplace.
This commit is contained in:
@@ -32,8 +32,7 @@ void ConstructorKeyword::endVisit(ContractDefinition const& _contract)
|
||||
{
|
||||
for (auto const* function: _contract.definedFunctions())
|
||||
if (function->name() == _contract.name())
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
function->location(),
|
||||
SourceTransform::replaceFunctionName(
|
||||
@@ -41,18 +40,15 @@ void ConstructorKeyword::endVisit(ContractDefinition const& _contract)
|
||||
function->name(),
|
||||
"constructor"
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void VisibilitySpecifier::endVisit(FunctionDefinition const& _function)
|
||||
{
|
||||
if (_function.noVisibilitySpecified())
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
_function.location(),
|
||||
SourceTransform::insertAfterRightParenthesis(_function.location(), "public")
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,12 +106,10 @@ void AbstractContract::endVisit(ContractDefinition const& _contract)
|
||||
!_contract.abstract() &&
|
||||
!_contract.isInterface()
|
||||
)
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
_contract.location(),
|
||||
SourceTransform::insertBeforeKeyword(_contract.location(), "contract", "abstract")
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,12 +130,10 @@ void OverridingFunction::endVisit(ContractDefinition const& _contract)
|
||||
|
||||
/// Add override with contract list, if needed.
|
||||
if (!function->overrides() && expectedContracts.size() > 1)
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
function->location(),
|
||||
appendOverride(*function, expectedContracts)
|
||||
}
|
||||
);
|
||||
|
||||
for (auto [begin, end] = inheritedFunctions.equal_range(proxy); begin != end; begin++)
|
||||
@@ -151,12 +147,10 @@ void OverridingFunction::endVisit(ContractDefinition const& _contract)
|
||||
/// If function does not specify override and no override with
|
||||
/// contract list was added before.
|
||||
if (!function->overrides() && expectedContracts.size() <= 1)
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
function->location(),
|
||||
appendOverride(*function, expectedContracts)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -181,12 +175,10 @@ void VirtualFunction::endVisit(ContractDefinition const& _contract)
|
||||
function->visibility() > Visibility::Private
|
||||
)
|
||||
{
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
function->location(),
|
||||
appendVirtual(*function)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,12 +190,10 @@ void VirtualFunction::endVisit(ContractDefinition const& _contract)
|
||||
!super.virtualSemantics()
|
||||
)
|
||||
{
|
||||
m_changes.push_back(
|
||||
UpgradeChange{
|
||||
m_changes.emplace_back(
|
||||
UpgradeChange::Level::Safe,
|
||||
function->location(),
|
||||
appendVirtual(*function)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ vector<tuple<size_t, size_t>> RandomPairSelection::materialise(size_t _poolSize)
|
||||
index2 = SimulationRNG::uniformInt(0, _poolSize - 1);
|
||||
} while (index1 == index2);
|
||||
|
||||
selection.push_back({index1, index2});
|
||||
selection.emplace_back(index1, index2);
|
||||
}
|
||||
|
||||
return selection;
|
||||
@@ -58,7 +58,7 @@ vector<tuple<size_t, size_t>> PairMosaicSelection::materialise(size_t _poolSize)
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
tuple<size_t, size_t> pair = m_pattern[i % m_pattern.size()];
|
||||
selection.push_back({min(get<0>(pair), _poolSize - 1), min(get<1>(pair), _poolSize - 1)});
|
||||
selection.emplace_back(min(get<0>(pair), _poolSize - 1), min(get<1>(pair), _poolSize - 1));
|
||||
}
|
||||
|
||||
return selection;
|
||||
|
||||
Reference in New Issue
Block a user