Use optional for FunctionImport::returnType

This commit is contained in:
Jason Cobb 2020-05-12 11:17:23 -04:00
parent 20c8851f43
commit 899e6d7e2b
No known key found for this signature in database
GPG Key ID: 2A3F6A6DCA1E8DED
2 changed files with 5 additions and 2 deletions
libyul/backends/wasm

View File

@ -25,6 +25,7 @@
#include <vector>
#include <map>
#include <memory>
#include <optional>
namespace solidity::yul::wasm
{
@ -76,7 +77,7 @@ struct FunctionImport {
std::string externalName;
std::string internalName;
std::vector<std::string> paramTypes;
std::unique_ptr<std::string> returnType;
std::optional<std::string> returnType;
};
struct FunctionDefinition

View File

@ -29,6 +29,8 @@
#include <liblangutil/Exceptions.h>
#include <optional>
using namespace std;
using namespace solidity;
using namespace solidity::yul;
@ -125,7 +127,7 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call)
builtin->name.str().substr(4),
builtin->name.str(),
{},
builtin->returns.empty() ? nullptr : make_unique<string>(builtin->returns.front().str())
builtin->returns.empty() ? nullopt : make_optional<string>(builtin->returns.front().str())
};
for (auto const& param: builtin->parameters)
imp.paramTypes.emplace_back(param.str());