Merge pull request #9255 from ethereum/solidity-upgrade-constructor

[BREAKING] solidity-upgrade: added module to remove visibility of constructors
This commit is contained in:
chriseth
2020-07-21 13:24:39 +02:00
committed by GitHub
6 changed files with 132 additions and 109 deletions
+10 -1
View File
@@ -133,7 +133,8 @@ public:
return regex_replace(
_location.text(),
_regex,
_expression + " " + _keyword
_expression + " " + _keyword,
std::regex_constants::format_first_only
);
else
solAssert(
@@ -275,6 +276,14 @@ public:
{
return regex_replace(_location.text(), std::regex{"now"}, "block.timestamp");
}
static std::string removeVisibility(langutil::SourceLocation const& _location)
{
std::string replacement = _location.text();
for (auto const& replace: {"public ", "public", "internal ", "internal", "external ", "external"})
replacement = regex_replace(replacement, std::regex{replace}, "");
return replacement;
}
};
}