mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
C++ namespace cleanup (except tests).
This commit is contained in:
committed by
Daniel Kirchner
parent
8385256bdc
commit
6b23412fae
@@ -32,8 +32,8 @@
|
||||
#include <functional>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
using namespace solidity;
|
||||
using namespace solidity::frontend;
|
||||
|
||||
class IDDispenser
|
||||
{
|
||||
@@ -114,11 +114,11 @@ vector<VariableDeclaration const*> ContractDefinition::stateVariablesIncludingIn
|
||||
return stateVars;
|
||||
}
|
||||
|
||||
map<FixedHash<4>, FunctionTypePointer> ContractDefinition::interfaceFunctions() const
|
||||
map<util::FixedHash<4>, FunctionTypePointer> ContractDefinition::interfaceFunctions() const
|
||||
{
|
||||
auto exportedFunctionList = interfaceFunctionList();
|
||||
|
||||
map<FixedHash<4>, FunctionTypePointer> exportedFunctions;
|
||||
map<util::FixedHash<4>, FunctionTypePointer> exportedFunctions;
|
||||
for (auto const& it: exportedFunctionList)
|
||||
exportedFunctions.insert(it);
|
||||
|
||||
@@ -192,12 +192,12 @@ vector<EventDefinition const*> const& ContractDefinition::interfaceEvents() cons
|
||||
return *m_interfaceEvents;
|
||||
}
|
||||
|
||||
vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList() const
|
||||
vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList() const
|
||||
{
|
||||
if (!m_interfaceFunctionList)
|
||||
{
|
||||
set<string> signaturesSeen;
|
||||
m_interfaceFunctionList = make_unique<vector<pair<FixedHash<4>, FunctionTypePointer>>>();
|
||||
m_interfaceFunctionList = make_unique<vector<pair<util::FixedHash<4>, FunctionTypePointer>>>();
|
||||
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
|
||||
{
|
||||
vector<FunctionTypePointer> functions;
|
||||
@@ -216,7 +216,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::inter
|
||||
if (signaturesSeen.count(functionSignature) == 0)
|
||||
{
|
||||
signaturesSeen.insert(functionSignature);
|
||||
FixedHash<4> hash(dev::keccak256(functionSignature));
|
||||
util::FixedHash<4> hash(util::keccak256(functionSignature));
|
||||
m_interfaceFunctionList->emplace_back(hash, fun);
|
||||
}
|
||||
}
|
||||
@@ -749,7 +749,7 @@ bool Literal::looksLikeAddress() const
|
||||
bool Literal::passesAddressChecksum() const
|
||||
{
|
||||
solAssert(isHexNumber(), "Expected hex number");
|
||||
return dev::passesAddressChecksum(valueWithoutUnderscores(), true);
|
||||
return util::passesAddressChecksum(valueWithoutUnderscores(), true);
|
||||
}
|
||||
|
||||
string Literal::getChecksummedAddress() const
|
||||
@@ -760,5 +760,5 @@ string Literal::getChecksummedAddress() const
|
||||
if (address.length() > 40)
|
||||
return string();
|
||||
address.insert(address.begin(), 40 - address.size(), '0');
|
||||
return dev::getChecksummedAddress(address);
|
||||
return util::getChecksummedAddress(address);
|
||||
}
|
||||
|
||||
@@ -40,16 +40,14 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace yul
|
||||
namespace solidity::yul
|
||||
{
|
||||
// Forward-declaration to <yul/AsmData.h>
|
||||
struct Block;
|
||||
struct Dialect;
|
||||
}
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
class ASTVisitor;
|
||||
@@ -416,8 +414,8 @@ public:
|
||||
|
||||
/// @returns a map of canonical function signatures to FunctionDefinitions
|
||||
/// as intended for use by the ABI.
|
||||
std::map<FixedHash<4>, FunctionTypePointer> interfaceFunctions() const;
|
||||
std::vector<std::pair<FixedHash<4>, FunctionTypePointer>> const& interfaceFunctionList() const;
|
||||
std::map<util::FixedHash<4>, FunctionTypePointer> interfaceFunctions() const;
|
||||
std::vector<std::pair<util::FixedHash<4>, FunctionTypePointer>> const& interfaceFunctionList() const;
|
||||
|
||||
/// @returns a list of the inheritable members of this contract
|
||||
std::vector<Declaration const*> const& inheritableMembers() const;
|
||||
@@ -452,7 +450,7 @@ private:
|
||||
ContractKind m_contractKind;
|
||||
bool m_abstract{false};
|
||||
|
||||
mutable std::unique_ptr<std::vector<std::pair<FixedHash<4>, FunctionTypePointer>>> m_interfaceFunctionList;
|
||||
mutable std::unique_ptr<std::vector<std::pair<util::FixedHash<4>, FunctionTypePointer>>> m_interfaceFunctionList;
|
||||
mutable std::unique_ptr<std::vector<EventDefinition const*>> m_interfaceEvents;
|
||||
mutable std::unique_ptr<std::vector<Declaration const*>> m_inheritableMembers;
|
||||
};
|
||||
@@ -1905,6 +1903,4 @@ private:
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
#include <libsolidity/ast/ASTAnnotations.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
using namespace solidity;
|
||||
using namespace solidity::frontend;
|
||||
|
||||
|
||||
@@ -32,16 +32,14 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace yul
|
||||
namespace solidity::yul
|
||||
{
|
||||
struct AsmAnalysisInfo;
|
||||
struct Identifier;
|
||||
struct Dialect;
|
||||
}
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
class Type;
|
||||
@@ -252,4 +250,3 @@ struct FunctionCallAnnotation: ExpressionAnnotation
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
// How a function can mutate the EVM state.
|
||||
@@ -70,4 +68,3 @@ struct FuncCallArguments
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,12 @@
|
||||
|
||||
// Forward-declare all AST node types and related enums.
|
||||
|
||||
namespace langutil
|
||||
namespace solidity::langutil
|
||||
{
|
||||
enum class Token : unsigned int;
|
||||
}
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
class ASTNode;
|
||||
@@ -107,4 +105,3 @@ using ASTPointer = std::shared_ptr<T>;
|
||||
using ASTString = std::string;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
using namespace langutil;
|
||||
using namespace solidity::langutil;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
ASTJsonConverter::ASTJsonConverter(bool _legacy, map<string, unsigned> _sourceIndices):
|
||||
@@ -200,7 +198,7 @@ Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair<yul::Identifie
|
||||
|
||||
void ASTJsonConverter::print(ostream& _stream, ASTNode const& _node)
|
||||
{
|
||||
_stream << jsonPrettyPrint(toJson(_node));
|
||||
_stream << util::jsonPrettyPrint(toJson(_node));
|
||||
}
|
||||
|
||||
Json::Value&& ASTJsonConverter::toJson(ASTNode const& _node)
|
||||
@@ -792,13 +790,13 @@ bool ASTJsonConverter::visit(ElementaryTypeNameExpression const& _node)
|
||||
bool ASTJsonConverter::visit(Literal const& _node)
|
||||
{
|
||||
Json::Value value{_node.value()};
|
||||
if (!dev::validateUTF8(_node.value()))
|
||||
if (!util::validateUTF8(_node.value()))
|
||||
value = Json::nullValue;
|
||||
Token subdenomination = Token(_node.subDenomination());
|
||||
std::vector<pair<string, Json::Value>> attributes = {
|
||||
make_pair(m_legacy ? "token" : "kind", literalTokenKind(_node.token())),
|
||||
make_pair("value", value),
|
||||
make_pair(m_legacy ? "hexvalue" : "hexValue", toHex(asBytes(_node.value()))),
|
||||
make_pair(m_legacy ? "hexvalue" : "hexValue", util::toHex(util::asBytes(_node.value()))),
|
||||
make_pair(
|
||||
"subdenomination",
|
||||
subdenomination == Token::Illegal ?
|
||||
@@ -869,13 +867,13 @@ string ASTJsonConverter::literalTokenKind(Token _token)
|
||||
{
|
||||
switch (_token)
|
||||
{
|
||||
case dev::solidity::Token::Number:
|
||||
case Token::Number:
|
||||
return "number";
|
||||
case dev::solidity::Token::StringLiteral:
|
||||
case dev::solidity::Token::HexStringLiteral:
|
||||
case Token::StringLiteral:
|
||||
case Token::HexStringLiteral:
|
||||
return "string";
|
||||
case dev::solidity::Token::TrueLiteral:
|
||||
case dev::solidity::Token::FalseLiteral:
|
||||
case Token::TrueLiteral:
|
||||
case Token::FalseLiteral:
|
||||
return "bool";
|
||||
default:
|
||||
solAssert(false, "Unknown kind of literal token.");
|
||||
@@ -893,4 +891,3 @@ string ASTJsonConverter::type(VariableDeclaration const& _varDecl)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,12 @@
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
namespace langutil
|
||||
namespace solidity::langutil
|
||||
{
|
||||
struct SourceLocation;
|
||||
}
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -194,4 +192,3 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
#include <libsolidity/ast/AST.h>
|
||||
#include <libsolidity/ast/ASTUtils.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
VariableDeclaration const* rootVariableDeclaration(VariableDeclaration const& _varDecl)
|
||||
@@ -39,4 +37,3 @@ VariableDeclaration const* rootVariableDeclaration(VariableDeclaration const& _v
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
class VariableDeclaration;
|
||||
|
||||
/// Find the topmost referenced variable declaration when the given variable
|
||||
/// declaration value is an identifier. Works only for constant variable declarations.
|
||||
VariableDeclaration const* rootVariableDeclaration(VariableDeclaration const& _varDecl);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -329,4 +327,3 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
#include <libsolidity/ast/AST.h>
|
||||
#include <libsolidity/ast/ASTVisitor.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
void SourceUnit::accept(ASTVisitor& _visitor)
|
||||
@@ -896,4 +894,3 @@ void Literal::accept(ASTConstVisitor& _visitor) const
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
enum class ExperimentalFeature
|
||||
@@ -52,4 +50,3 @@ static std::map<std::string, ExperimentalFeature> const ExperimentalFeatureNames
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace solidity;
|
||||
using namespace solidity::frontend;
|
||||
using namespace solidity::util;
|
||||
|
||||
BoolType const TypeProvider::m_boolean{};
|
||||
InaccessibleDynamicType const TypeProvider::m_inaccessibleDynamic{};
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -225,5 +223,4 @@ private:
|
||||
std::vector<std::unique_ptr<Type>> m_generalTypes{};
|
||||
};
|
||||
|
||||
} // namespace solidity
|
||||
} // namespace dev
|
||||
}
|
||||
|
||||
+27
-27
@@ -45,9 +45,9 @@
|
||||
#include <limits>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace dev::solidity;
|
||||
using namespace solidity;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::frontend;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -131,7 +131,7 @@ bool fitsIntoBits(bigint const& _value, unsigned _bits, bool _signed)
|
||||
));
|
||||
}
|
||||
|
||||
Result<TypePointers> transformParametersToExternal(TypePointers const& _parameters, bool _inLibrary)
|
||||
util::Result<TypePointers> transformParametersToExternal(TypePointers const& _parameters, bool _inLibrary)
|
||||
{
|
||||
TypePointers transformed;
|
||||
|
||||
@@ -140,7 +140,7 @@ Result<TypePointers> transformParametersToExternal(TypePointers const& _paramete
|
||||
if (TypePointer ext = type->interfaceType(_inLibrary).get())
|
||||
transformed.push_back(ext);
|
||||
else
|
||||
return Result<TypePointers>::err("Parameter should have external type.");
|
||||
return util::Result<TypePointers>::err("Parameter should have external type.");
|
||||
}
|
||||
|
||||
return transformed;
|
||||
@@ -170,7 +170,7 @@ void StorageOffsets::computeOffsets(TypePointers const& _types)
|
||||
byteOffset = 0;
|
||||
}
|
||||
if (slotOffset >= bigint(1) << 256)
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << errinfo_comment("Object too large for storage."));
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Object too large for storage."));
|
||||
offsets[i] = make_pair(u256(slotOffset), byteOffset);
|
||||
solAssert(type->storageSize() >= 1, "Invalid storage size.");
|
||||
if (type->storageSize() == 1 && byteOffset + type->storageBytes() <= 32)
|
||||
@@ -184,7 +184,7 @@ void StorageOffsets::computeOffsets(TypePointers const& _types)
|
||||
if (byteOffset > 0)
|
||||
++slotOffset;
|
||||
if (slotOffset >= bigint(1) << 256)
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << errinfo_comment("Object too large for storage."));
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Object too large for storage."));
|
||||
m_storageSize = u256(slotOffset);
|
||||
swap(m_offsets, offsets);
|
||||
}
|
||||
@@ -486,7 +486,7 @@ IntegerType::IntegerType(unsigned _bits, IntegerType::Modifier _modifier):
|
||||
{
|
||||
solAssert(
|
||||
m_bits > 0 && m_bits <= 256 && m_bits % 8 == 0,
|
||||
"Invalid bit number for integer type: " + dev::toString(m_bits)
|
||||
"Invalid bit number for integer type: " + util::toString(m_bits)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ bool IntegerType::operator==(Type const& _other) const
|
||||
string IntegerType::toString(bool) const
|
||||
{
|
||||
string prefix = isSigned() ? "int" : "uint";
|
||||
return prefix + dev::toString(m_bits);
|
||||
return prefix + util::toString(m_bits);
|
||||
}
|
||||
|
||||
bigint IntegerType::minValue() const
|
||||
@@ -615,7 +615,7 @@ FixedPointType::FixedPointType(unsigned _totalBits, unsigned _fractionalDigits,
|
||||
solAssert(
|
||||
8 <= m_totalBits && m_totalBits <= 256 && m_totalBits % 8 == 0 && m_fractionalDigits <= 80,
|
||||
"Invalid bit number(s) for fixed type: " +
|
||||
dev::toString(_totalBits) + "x" + dev::toString(_fractionalDigits)
|
||||
util::toString(_totalBits) + "x" + util::toString(_fractionalDigits)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ bool FixedPointType::operator==(Type const& _other) const
|
||||
string FixedPointType::toString(bool) const
|
||||
{
|
||||
string prefix = isSigned() ? "fixed" : "ufixed";
|
||||
return prefix + dev::toString(m_totalBits) + "x" + dev::toString(m_fractionalDigits);
|
||||
return prefix + util::toString(m_totalBits) + "x" + util::toString(m_fractionalDigits);
|
||||
}
|
||||
|
||||
bigint FixedPointType::maxIntegerValue() const
|
||||
@@ -1134,7 +1134,7 @@ bool RationalNumberType::operator==(Type const& _other) const
|
||||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
string RationalNumberType::bigintToReadableString(dev::bigint const& _num)
|
||||
string RationalNumberType::bigintToReadableString(bigint const& _num)
|
||||
{
|
||||
string str = _num.str();
|
||||
if (str.size() > 32)
|
||||
@@ -1203,7 +1203,7 @@ IntegerType const* RationalNumberType::integerType() const
|
||||
return nullptr;
|
||||
else
|
||||
return TypeProvider::integer(
|
||||
max(bytesRequired(value), 1u) * 8,
|
||||
max(util::bytesRequired(value), 1u) * 8,
|
||||
negative ? IntegerType::Modifier::Signed : IntegerType::Modifier::Unsigned
|
||||
);
|
||||
}
|
||||
@@ -1237,7 +1237,7 @@ FixedPointType const* RationalNumberType::fixedPointType() const
|
||||
if (v > u256(-1))
|
||||
return nullptr;
|
||||
|
||||
unsigned totalBits = max(bytesRequired(v), 1u) * 8;
|
||||
unsigned totalBits = max(util::bytesRequired(v), 1u) * 8;
|
||||
solAssert(totalBits <= 256, "");
|
||||
|
||||
return TypeProvider::fixedPoint(
|
||||
@@ -1273,7 +1273,7 @@ string StringLiteralType::richIdentifier() const
|
||||
{
|
||||
// Since we have to return a valid identifier and the string itself may contain
|
||||
// anything, we hash it.
|
||||
return "t_stringliteral_" + toHex(keccak256(m_value).asBytes());
|
||||
return "t_stringliteral_" + util::toHex(util::keccak256(m_value).asBytes());
|
||||
}
|
||||
|
||||
bool StringLiteralType::operator==(Type const& _other) const
|
||||
@@ -1287,8 +1287,8 @@ std::string StringLiteralType::toString(bool) const
|
||||
{
|
||||
size_t invalidSequence;
|
||||
|
||||
if (!dev::validateUTF8(m_value, invalidSequence))
|
||||
return "literal_string (contains invalid UTF-8 sequence at position " + dev::toString(invalidSequence) + ")";
|
||||
if (!util::validateUTF8(m_value, invalidSequence))
|
||||
return "literal_string (contains invalid UTF-8 sequence at position " + util::toString(invalidSequence) + ")";
|
||||
|
||||
return "literal_string \"" + m_value + "\"";
|
||||
}
|
||||
@@ -1300,14 +1300,14 @@ TypePointer StringLiteralType::mobileType() const
|
||||
|
||||
bool StringLiteralType::isValidUTF8() const
|
||||
{
|
||||
return dev::validateUTF8(m_value);
|
||||
return util::validateUTF8(m_value);
|
||||
}
|
||||
|
||||
FixedBytesType::FixedBytesType(unsigned _bytes): m_bytes(_bytes)
|
||||
{
|
||||
solAssert(
|
||||
m_bytes > 0 && m_bytes <= 32,
|
||||
"Invalid byte number for fixed bytes type: " + dev::toString(m_bytes)
|
||||
"Invalid byte number for fixed bytes type: " + util::toString(m_bytes)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1697,7 +1697,7 @@ u256 ArrayType::storageSize() const
|
||||
else
|
||||
size = bigint(length()) * baseType()->storageSize();
|
||||
if (size >= bigint(1) << 256)
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << errinfo_comment("Array too large for storage."));
|
||||
BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Array too large for storage."));
|
||||
return max<u256>(1, u256(size));
|
||||
}
|
||||
|
||||
@@ -2145,7 +2145,7 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
|
||||
|
||||
auto visitor = [&](
|
||||
StructDefinition const& _struct,
|
||||
CycleDetector<StructDefinition>& _cycleDetector,
|
||||
util::CycleDetector<StructDefinition>& _cycleDetector,
|
||||
size_t /*_depth*/
|
||||
)
|
||||
{
|
||||
@@ -2193,7 +2193,7 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
|
||||
}
|
||||
};
|
||||
|
||||
m_recursive = m_recursive.value() || (CycleDetector<StructDefinition>(visitor).run(structDefinition()) != nullptr);
|
||||
m_recursive = m_recursive.value() || (util::CycleDetector<StructDefinition>(visitor).run(structDefinition()) != nullptr);
|
||||
|
||||
std::string const recursiveErrMsg = "Recursive type not allowed for public or external contract functions.";
|
||||
|
||||
@@ -2338,7 +2338,7 @@ unsigned EnumType::storageBytes() const
|
||||
if (elements <= 1)
|
||||
return 1;
|
||||
else
|
||||
return dev::bytesRequired(elements - 1);
|
||||
return util::bytesRequired(elements - 1);
|
||||
}
|
||||
|
||||
string EnumType::toString(bool) const
|
||||
@@ -2908,13 +2908,13 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const
|
||||
solAssert(m_declaration, "Declaration needed to determine interface function type.");
|
||||
bool isLibraryFunction = kind() != Kind::Event && dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
|
||||
|
||||
Result<TypePointers> paramTypes =
|
||||
util::Result<TypePointers> paramTypes =
|
||||
transformParametersToExternal(m_parameterTypes, isLibraryFunction);
|
||||
|
||||
if (!paramTypes.message().empty())
|
||||
return FunctionTypePointer();
|
||||
|
||||
Result<TypePointers> retParamTypes =
|
||||
util::Result<TypePointers> retParamTypes =
|
||||
transformParametersToExternal(m_returnParameterTypes, isLibraryFunction);
|
||||
|
||||
if (!retParamTypes.message().empty())
|
||||
@@ -3171,12 +3171,12 @@ string FunctionType::externalSignature() const
|
||||
|
||||
u256 FunctionType::externalIdentifier() const
|
||||
{
|
||||
return FixedHash<4>::Arith(FixedHash<4>(dev::keccak256(externalSignature())));
|
||||
return util::FixedHash<4>::Arith(util::FixedHash<4>(util::keccak256(externalSignature())));
|
||||
}
|
||||
|
||||
string FunctionType::externalIdentifierHex() const
|
||||
{
|
||||
return FixedHash<4>(dev::keccak256(externalSignature())).hex();
|
||||
return util::FixedHash<4>(util::keccak256(externalSignature())).hex();
|
||||
}
|
||||
|
||||
bool FunctionType::isPure() const
|
||||
|
||||
@@ -39,9 +39,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace solidity::frontend
|
||||
{
|
||||
|
||||
class TypeProvider;
|
||||
@@ -50,9 +48,9 @@ class FunctionType; // forward
|
||||
using TypePointer = Type const*;
|
||||
using FunctionTypePointer = FunctionType const*;
|
||||
using TypePointers = std::vector<TypePointer>;
|
||||
using rational = boost::rational<dev::bigint>;
|
||||
using TypeResult = Result<TypePointer>;
|
||||
using BoolResult = Result<bool>;
|
||||
using rational = boost::rational<bigint>;
|
||||
using TypeResult = util::Result<TypePointer>;
|
||||
using BoolResult = util::Result<bool>;
|
||||
|
||||
inline rational makeRational(bigint const& _numerator, bigint const& _denominator)
|
||||
{
|
||||
@@ -539,7 +537,7 @@ private:
|
||||
|
||||
/// @returns a truncated readable representation of the bigint keeping only
|
||||
/// up to 4 leading and 4 trailing digits.
|
||||
static std::string bigintToReadableString(dev::bigint const& num);
|
||||
static std::string bigintToReadableString(bigint const& num);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -599,7 +597,7 @@ public:
|
||||
bool leftAligned() const override { return true; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
std::string toString(bool) const override { return "bytes" + dev::toString(m_bytes); }
|
||||
std::string toString(bool) const override { return "bytes" + util::toString(m_bytes); }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
TypePointer encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
@@ -1445,4 +1443,3 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user