Merge remote-tracking branch 'origin/develop' into develop_060

This commit is contained in:
chriseth
2019-10-28 15:21:49 +01:00
67 changed files with 182 additions and 165 deletions
+5 -4
View File
@@ -36,6 +36,7 @@
#include <json/json.h>
#include <memory>
#include <optional>
#include <string>
#include <vector>
@@ -949,10 +950,10 @@ public:
ElementaryTypeName(
SourceLocation const& _location,
ElementaryTypeNameToken const& _elem,
boost::optional<StateMutability> _stateMutability = {}
std::optional<StateMutability> _stateMutability = {}
): TypeName(_location), m_type(_elem), m_stateMutability(_stateMutability)
{
solAssert(!_stateMutability.is_initialized() || _elem.token() == Token::Address, "");
solAssert(!_stateMutability.has_value() || _elem.token() == Token::Address, "");
}
void accept(ASTVisitor& _visitor) override;
@@ -960,11 +961,11 @@ public:
ElementaryTypeNameToken const& typeName() const { return m_type; }
boost::optional<StateMutability> const& stateMutability() const { return m_stateMutability; }
std::optional<StateMutability> const& stateMutability() const { return m_stateMutability; }
private:
ElementaryTypeNameToken m_type;
boost::optional<StateMutability> m_stateMutability; ///< state mutability for address type
std::optional<StateMutability> m_stateMutability; ///< state mutability for address type
};
/**
+2 -3
View File
@@ -26,10 +26,9 @@
#include <libsolidity/ast/ASTEnums.h>
#include <libsolidity/ast/ExperimentalFeatures.h>
#include <boost/optional.hpp>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <vector>
@@ -183,7 +182,7 @@ struct ExpressionAnnotation: ASTAnnotation
/// Types and - if given - names of arguments if the expr. is a function
/// that is called, used for overload resoultion
boost::optional<FuncCallArguments> arguments;
std::optional<FuncCallArguments> arguments;
};
struct IdentifierAnnotation: ExpressionAnnotation
+1 -1
View File
@@ -148,7 +148,7 @@ Json::Value ASTJsonConverter::typePointerToJson(TypePointer _tp, bool _short)
return typeDescriptions;
}
Json::Value ASTJsonConverter::typePointerToJson(boost::optional<FuncCallArguments> const& _tps)
Json::Value ASTJsonConverter::typePointerToJson(std::optional<FuncCallArguments> const& _tps)
{
if (_tps)
{
+4 -2
View File
@@ -27,10 +27,12 @@
#include <liblangutil/Exceptions.h>
#include <json/json.h>
#include <algorithm>
#include <optional>
#include <ostream>
#include <stack>
#include <vector>
#include <algorithm>
namespace langutil
{
@@ -172,7 +174,7 @@ private:
return json;
}
static Json::Value typePointerToJson(TypePointer _tp, bool _short = false);
static Json::Value typePointerToJson(boost::optional<FuncCallArguments> const& _tps);
static Json::Value typePointerToJson(std::optional<FuncCallArguments> const& _tps);
void appendExpressionAttributes(
std::vector<std::pair<std::string, Json::Value>> &_attributes,
ExpressionAnnotation const& _annotation
+1 -1
View File
@@ -202,7 +202,7 @@ inline T const* TypeProvider::createAndGet(Args&& ... _args)
return static_cast<T const*>(instance().m_generalTypes.back().get());
}
Type const* TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken const& _type, boost::optional<StateMutability> _stateMutability)
Type const* TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken const& _type, std::optional<StateMutability> _stateMutability)
{
solAssert(
TokenTraits::isElementaryTypeName(_type.token()),
+2 -1
View File
@@ -22,6 +22,7 @@
#include <array>
#include <map>
#include <memory>
#include <optional>
#include <utility>
namespace dev
@@ -54,7 +55,7 @@ public:
/// @name Factory functions
/// Factory functions that convert an AST @ref TypeName to a Type.
static Type const* fromElementaryTypeName(ElementaryTypeNameToken const& _type, boost::optional<StateMutability> _stateMutability = {});
static Type const* fromElementaryTypeName(ElementaryTypeNameToken const& _type, std::optional<StateMutability> _stateMutability = {});
/// Converts a given elementary type name with optional data location
/// suffix " storage", " calldata" or " memory" to a type pointer. If suffix not given, defaults to " storage".
+7 -7
View File
@@ -1824,10 +1824,10 @@ TypePointer ArrayType::decodingType() const
TypeResult ArrayType::interfaceType(bool _inLibrary) const
{
if (_inLibrary && m_interfaceType_library.is_initialized())
if (_inLibrary && m_interfaceType_library.has_value())
return *m_interfaceType_library;
if (!_inLibrary && m_interfaceType.is_initialized())
if (!_inLibrary && m_interfaceType.has_value())
return *m_interfaceType;
TypeResult result{TypePointer{}};
@@ -2142,10 +2142,10 @@ MemberList::MemberMap StructType::nativeMembers(ContractDefinition const*) const
TypeResult StructType::interfaceType(bool _inLibrary) const
{
if (_inLibrary && m_interfaceType_library.is_initialized())
if (_inLibrary && m_interfaceType_library.has_value())
return *m_interfaceType_library;
if (!_inLibrary && m_interfaceType.is_initialized())
if (!_inLibrary && m_interfaceType.has_value())
return *m_interfaceType;
TypeResult result{TypePointer{}};
@@ -2202,7 +2202,7 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
}
};
m_recursive = m_recursive.get() || (CycleDetector<StructDefinition>(visitor).run(structDefinition()) != nullptr);
m_recursive = m_recursive.value() || (CycleDetector<StructDefinition>(visitor).run(structDefinition()) != nullptr);
std::string const recursiveErrMsg = "Recursive type not allowed for public or external contract functions.";
@@ -2215,13 +2215,13 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
else
m_interfaceType_library = TypeProvider::withLocation(this, DataLocation::Memory, true);
if (m_recursive.get())
if (m_recursive.value())
m_interfaceType = TypeResult::err(recursiveErrMsg);
return *m_interfaceType_library;
}
if (m_recursive.get())
if (m_recursive.value())
m_interfaceType = TypeResult::err(recursiveErrMsg);
else if (!result.message().empty())
m_interfaceType = result;
+9 -9
View File
@@ -31,11 +31,11 @@
#include <libdevcore/CommonIO.h>
#include <libdevcore/Result.h>
#include <boost/optional.hpp>
#include <boost/rational.hpp>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
@@ -769,8 +769,8 @@ private:
Type const* m_baseType;
bool m_hasDynamicLength = true;
u256 m_length;
mutable boost::optional<TypeResult> m_interfaceType;
mutable boost::optional<TypeResult> m_interfaceType_library;
mutable std::optional<TypeResult> m_interfaceType;
mutable std::optional<TypeResult> m_interfaceType_library;
};
class ArraySliceType: public ReferenceType
@@ -894,12 +894,12 @@ public:
bool recursive() const
{
if (m_recursive.is_initialized())
return m_recursive.get();
if (m_recursive.has_value())
return m_recursive.value();
interfaceType(false);
return m_recursive.get();
return m_recursive.value();
}
std::unique_ptr<ReferenceType> copyForLocation(DataLocation _location, bool _isPointer) const override;
@@ -927,9 +927,9 @@ public:
private:
StructDefinition const& m_struct;
// Caches for interfaceType(bool)
mutable boost::optional<TypeResult> m_interfaceType;
mutable boost::optional<TypeResult> m_interfaceType_library;
mutable boost::optional<bool> m_recursive;
mutable std::optional<TypeResult> m_interfaceType;
mutable std::optional<TypeResult> m_interfaceType_library;
mutable std::optional<bool> m_recursive;
};
/**