mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not insert SPDX line if it is already present (in semantic tests)
This commit is contained in:
parent
3a7a0e4256
commit
34cab95446
@ -51,9 +51,11 @@ AnalysisFramework::parseAnalyseAndReturnError(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
compiler().reset();
|
compiler().reset();
|
||||||
|
// Do not insert license if it is already present.
|
||||||
|
bool insertLicense = _insertLicenseAndVersionPragma && _source.find("// SPDX-License-Identifier:") == string::npos;
|
||||||
compiler().setSources({{"",
|
compiler().setSources({{"",
|
||||||
_insertLicenseAndVersionPragma ?
|
string{_insertLicenseAndVersionPragma ? "pragma solidity >=0.0;\n" : ""} +
|
||||||
"pragma solidity >=0.0;\n// SPDX-License-Identifier: GPL-3.0\n" + _source :
|
string{insertLicense ? "// SPDX-License-Identifier: GPL-3.0\n" : ""} +
|
||||||
_source
|
_source
|
||||||
}});
|
}});
|
||||||
compiler().setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
|
compiler().setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
|
||||||
|
@ -132,7 +132,9 @@ bytes SolidityExecutionFramework::compileContract(
|
|||||||
string SolidityExecutionFramework::addPreamble(string const& _sourceCode)
|
string SolidityExecutionFramework::addPreamble(string const& _sourceCode)
|
||||||
{
|
{
|
||||||
// Silence compiler version warning
|
// Silence compiler version warning
|
||||||
string preamble = "pragma solidity >=0.0;\n// SPDX-License-Identifier: unlicensed\n";
|
string preamble = "pragma solidity >=0.0;\n";
|
||||||
|
if (_sourceCode.find("// SPDX-License-Identifier:") == string::npos)
|
||||||
|
preamble += "// SPDX-License-Identifier: unlicensed\n";
|
||||||
if (
|
if (
|
||||||
solidity::test::CommonOptions::get().useABIEncoderV2 &&
|
solidity::test::CommonOptions::get().useABIEncoderV2 &&
|
||||||
_sourceCode.find("pragma experimental ABIEncoderV2;") == string::npos &&
|
_sourceCode.find("pragma experimental ABIEncoderV2;") == string::npos &&
|
||||||
|
Loading…
Reference in New Issue
Block a user