mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11136 from ethereum/refactor-typepointer
Replace `TypePointer` with `Type const*`
This commit is contained in:
+10
-10
@@ -78,7 +78,7 @@ ImportAnnotation& ImportDirective::annotation() const
|
||||
return initAnnotation<ImportAnnotation>();
|
||||
}
|
||||
|
||||
TypePointer ImportDirective::type() const
|
||||
Type const* ImportDirective::type() const
|
||||
{
|
||||
solAssert(!!annotation().sourceUnit, "");
|
||||
return TypeProvider::module(*annotation().sourceUnit);
|
||||
@@ -206,7 +206,7 @@ uint32_t ContractDefinition::interfaceId() const
|
||||
return result;
|
||||
}
|
||||
|
||||
TypePointer ContractDefinition::type() const
|
||||
Type const* ContractDefinition::type() const
|
||||
{
|
||||
return TypeProvider::typeType(TypeProvider::contract(*this));
|
||||
}
|
||||
@@ -252,7 +252,7 @@ TypeNameAnnotation& TypeName::annotation() const
|
||||
return initAnnotation<TypeNameAnnotation>();
|
||||
}
|
||||
|
||||
TypePointer StructDefinition::type() const
|
||||
Type const* StructDefinition::type() const
|
||||
{
|
||||
solAssert(annotation().recursive.has_value(), "Requested struct type before DeclarationTypeChecker.");
|
||||
return TypeProvider::typeType(TypeProvider::structType(*this, DataLocation::Storage));
|
||||
@@ -263,14 +263,14 @@ StructDeclarationAnnotation& StructDefinition::annotation() const
|
||||
return initAnnotation<StructDeclarationAnnotation>();
|
||||
}
|
||||
|
||||
TypePointer EnumValue::type() const
|
||||
Type const* EnumValue::type() const
|
||||
{
|
||||
auto parentDef = dynamic_cast<EnumDefinition const*>(scope());
|
||||
solAssert(parentDef, "Enclosing Scope of EnumValue was not set");
|
||||
return TypeProvider::enumType(*parentDef);
|
||||
}
|
||||
|
||||
TypePointer EnumDefinition::type() const
|
||||
Type const* EnumDefinition::type() const
|
||||
{
|
||||
return TypeProvider::typeType(TypeProvider::enumType(*this));
|
||||
}
|
||||
@@ -328,13 +328,13 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
|
||||
return {};
|
||||
}
|
||||
|
||||
TypePointer FunctionDefinition::type() const
|
||||
Type const* FunctionDefinition::type() const
|
||||
{
|
||||
solAssert(visibility() != Visibility::External, "");
|
||||
return TypeProvider::function(*this, FunctionType::Kind::Internal);
|
||||
}
|
||||
|
||||
TypePointer FunctionDefinition::typeViaContractName() const
|
||||
Type const* FunctionDefinition::typeViaContractName() const
|
||||
{
|
||||
if (libraryFunction())
|
||||
{
|
||||
@@ -395,7 +395,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual(
|
||||
return *this; // not reached
|
||||
}
|
||||
|
||||
TypePointer ModifierDefinition::type() const
|
||||
Type const* ModifierDefinition::type() const
|
||||
{
|
||||
return TypeProvider::modifier(*this);
|
||||
}
|
||||
@@ -432,7 +432,7 @@ ModifierDefinition const& ModifierDefinition::resolveVirtual(
|
||||
}
|
||||
|
||||
|
||||
TypePointer EventDefinition::type() const
|
||||
Type const* EventDefinition::type() const
|
||||
{
|
||||
return TypeProvider::function(*this);
|
||||
}
|
||||
@@ -672,7 +672,7 @@ string VariableDeclaration::externalIdentifierHex() const
|
||||
return TypeProvider::function(*this)->externalIdentifierHex();
|
||||
}
|
||||
|
||||
TypePointer VariableDeclaration::type() const
|
||||
Type const* VariableDeclaration::type() const
|
||||
{
|
||||
return annotation().type;
|
||||
}
|
||||
|
||||
+13
-13
@@ -272,11 +272,11 @@ public:
|
||||
|
||||
/// @returns the type of expressions referencing this declaration.
|
||||
/// This can only be called once types of variable declarations have already been resolved.
|
||||
virtual TypePointer type() const = 0;
|
||||
virtual Type const* type() const = 0;
|
||||
|
||||
/// @returns the type for members of the containing contract type that refer to this declaration.
|
||||
/// This can only be called once types of variable declarations have already been resolved.
|
||||
virtual TypePointer typeViaContractName() const { return type(); }
|
||||
virtual Type const* typeViaContractName() const { return type(); }
|
||||
|
||||
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
|
||||
/// @returns null when it is not accessible as a function.
|
||||
@@ -366,7 +366,7 @@ public:
|
||||
}
|
||||
ImportAnnotation& annotation() const override;
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
private:
|
||||
ASTPointer<ASTString> m_path;
|
||||
@@ -539,7 +539,7 @@ public:
|
||||
|
||||
std::string fullyQualifiedName() const { return sourceUnitName() + ":" + name(); }
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
ContractDefinitionAnnotation& annotation() const override;
|
||||
|
||||
@@ -658,7 +658,7 @@ public:
|
||||
|
||||
std::vector<ASTPointer<VariableDeclaration>> const& members() const { return m_members; }
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
bool isVisibleInDerivedContracts() const override { return true; }
|
||||
bool isVisibleViaContractTypeAccess() const override { return true; }
|
||||
@@ -688,7 +688,7 @@ public:
|
||||
|
||||
std::vector<ASTPointer<EnumValue>> const& members() const { return m_members; }
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
TypeDeclarationAnnotation& annotation() const override;
|
||||
|
||||
@@ -708,7 +708,7 @@ public:
|
||||
void accept(ASTVisitor& _visitor) override;
|
||||
void accept(ASTConstVisitor& _visitor) const override;
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -883,8 +883,8 @@ public:
|
||||
/// @returns the external identifier of this function (the hash of the signature) as a hex string.
|
||||
std::string externalIdentifierHex() const;
|
||||
|
||||
TypePointer type() const override;
|
||||
TypePointer typeViaContractName() const override;
|
||||
Type const* type() const override;
|
||||
Type const* typeViaContractName() const override;
|
||||
|
||||
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
|
||||
/// @returns null when it is not accessible as a function.
|
||||
@@ -1010,7 +1010,7 @@ public:
|
||||
/// @returns the external identifier of this variable (the hash of the signature) as a hex string (works only for public state variables).
|
||||
std::string externalIdentifierHex() const;
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.
|
||||
/// @returns null when it is not accessible as a function.
|
||||
@@ -1062,7 +1062,7 @@ public:
|
||||
|
||||
Block const& body() const { solAssert(m_body, ""); return *m_body; }
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
|
||||
Visibility defaultVisibility() const override { return Visibility::Internal; }
|
||||
|
||||
@@ -1135,7 +1135,7 @@ public:
|
||||
|
||||
bool isAnonymous() const { return m_anonymous; }
|
||||
|
||||
TypePointer type() const override;
|
||||
Type const* type() const override;
|
||||
FunctionTypePointer functionType(bool /*_internal*/) const override;
|
||||
|
||||
bool isVisibleInDerivedContracts() const override { return true; }
|
||||
@@ -1179,7 +1179,7 @@ public:
|
||||
solAssert(m_type->category() == Type::Category::Function, "");
|
||||
return dynamic_cast<FunctionType const*>(m_type);
|
||||
}
|
||||
TypePointer type() const override { return m_type; }
|
||||
Type const* type() const override { return m_type; }
|
||||
|
||||
private:
|
||||
Type const* m_type;
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace solidity::frontend
|
||||
{
|
||||
|
||||
class Type;
|
||||
using TypePointer = Type const*;
|
||||
class ArrayType;
|
||||
using namespace util;
|
||||
|
||||
@@ -192,7 +191,7 @@ struct ModifierDefinitionAnnotation: CallableDeclarationAnnotation, Structurally
|
||||
struct VariableDeclarationAnnotation: DeclarationAnnotation, StructurallyDocumentedAnnotation
|
||||
{
|
||||
/// Type of variable (type of identifier referencing this variable).
|
||||
TypePointer type = nullptr;
|
||||
Type const* type = nullptr;
|
||||
/// The set of functions this (public state) variable overrides.
|
||||
std::set<CallableDeclaration const*> baseFunctions;
|
||||
};
|
||||
@@ -239,7 +238,7 @@ struct TypeNameAnnotation: ASTAnnotation
|
||||
{
|
||||
/// Type declared by this type name, i.e. type of a variable where this type name is used.
|
||||
/// Set during reference resolution stage.
|
||||
TypePointer type = nullptr;
|
||||
Type const* type = nullptr;
|
||||
};
|
||||
|
||||
struct IdentifierPathAnnotation: ASTAnnotation
|
||||
@@ -253,7 +252,7 @@ struct IdentifierPathAnnotation: ASTAnnotation
|
||||
struct ExpressionAnnotation: ASTAnnotation
|
||||
{
|
||||
/// Inferred type of the expression.
|
||||
TypePointer type = nullptr;
|
||||
Type const* type = nullptr;
|
||||
/// Whether the expression is a constant variable
|
||||
SetOnce<bool> isConstant;
|
||||
/// Whether the expression is pure, i.e. compile-time constant.
|
||||
@@ -305,7 +304,7 @@ struct BinaryOperationAnnotation: ExpressionAnnotation
|
||||
{
|
||||
/// The common type that is used for the operation, not necessarily the result type (which
|
||||
/// e.g. for comparisons is bool).
|
||||
TypePointer commonType = nullptr;
|
||||
Type const* commonType = nullptr;
|
||||
};
|
||||
|
||||
enum class FunctionCallKind
|
||||
|
||||
@@ -129,7 +129,7 @@ string ASTJsonConverter::namePathToString(std::vector<ASTString> const& _namePat
|
||||
return boost::algorithm::join(_namePath, ".");
|
||||
}
|
||||
|
||||
Json::Value ASTJsonConverter::typePointerToJson(TypePointer _tp, bool _short)
|
||||
Json::Value ASTJsonConverter::typePointerToJson(Type const* _tp, bool _short)
|
||||
{
|
||||
Json::Value typeDescriptions(Json::objectValue);
|
||||
typeDescriptions["typeString"] = _tp ? Json::Value(_tp->toString(_short)) : Json::nullValue;
|
||||
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
|
||||
return json;
|
||||
}
|
||||
static Json::Value typePointerToJson(TypePointer _tp, bool _short = false);
|
||||
static Json::Value typePointerToJson(Type const* _tp, bool _short = false);
|
||||
static Json::Value typePointerToJson(std::optional<FuncCallArguments> const& _tps);
|
||||
void appendExpressionAttributes(
|
||||
std::vector<std::pair<std::string, Json::Value>> &_attributes,
|
||||
|
||||
@@ -259,7 +259,7 @@ Type const* TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken const&
|
||||
}
|
||||
}
|
||||
|
||||
TypePointer TypeProvider::fromElementaryTypeName(string const& _name)
|
||||
Type const* TypeProvider::fromElementaryTypeName(string const& _name)
|
||||
{
|
||||
vector<string> nameParts;
|
||||
boost::split(nameParts, _name, boost::is_any_of(" "));
|
||||
@@ -339,7 +339,7 @@ ArrayType const* TypeProvider::stringMemory()
|
||||
return m_stringMemory.get();
|
||||
}
|
||||
|
||||
TypePointer TypeProvider::forLiteral(Literal const& _literal)
|
||||
Type const* TypeProvider::forLiteral(Literal const& _literal)
|
||||
{
|
||||
switch (_literal.token())
|
||||
{
|
||||
@@ -363,7 +363,7 @@ RationalNumberType const* TypeProvider::rationalNumber(Literal const& _literal)
|
||||
std::tuple<bool, rational> validLiteral = RationalNumberType::isValidLiteral(_literal);
|
||||
if (std::get<0>(validLiteral))
|
||||
{
|
||||
TypePointer compatibleBytesType = nullptr;
|
||||
Type const* compatibleBytesType = nullptr;
|
||||
if (_literal.isHexNumber())
|
||||
{
|
||||
size_t const digitCount = _literal.valueWithoutUnderscores().length() - 2;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
/// 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".
|
||||
static TypePointer fromElementaryTypeName(std::string const& _name);
|
||||
static Type const* fromElementaryTypeName(std::string const& _name);
|
||||
|
||||
/// @returns boolean type.
|
||||
static BoolType const* boolean() noexcept { return &m_boolean; }
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
/// Auto-detect the proper type for a literal. @returns an empty pointer if the literal does
|
||||
/// not fit any type.
|
||||
static TypePointer forLiteral(Literal const& _literal);
|
||||
static Type const* forLiteral(Literal const& _literal);
|
||||
static RationalNumberType const* rationalNumber(Literal const& _literal);
|
||||
|
||||
static RationalNumberType const* rationalNumber(
|
||||
|
||||
+39
-39
@@ -100,7 +100,7 @@ util::Result<TypePointers> transformParametersToExternal(TypePointers const& _pa
|
||||
{
|
||||
if (!type)
|
||||
return util::Result<TypePointers>::err("Type information not present.");
|
||||
else if (TypePointer ext = type->interfaceType(_inLibrary).get())
|
||||
else if (Type const* ext = type->interfaceType(_inLibrary).get())
|
||||
transformed.push_back(ext);
|
||||
else
|
||||
return util::Result<TypePointers>::err("Parameter should have external type.");
|
||||
@@ -225,7 +225,7 @@ string richIdentifier(Type const* _type)
|
||||
return _type ? _type->richIdentifier() : "";
|
||||
}
|
||||
|
||||
string identifierList(vector<TypePointer> const& _list)
|
||||
string identifierList(vector<Type const*> const& _list)
|
||||
{
|
||||
return identifierList(_list | boost::adaptors::transformed(richIdentifier));
|
||||
}
|
||||
@@ -272,7 +272,7 @@ string Type::identifier() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
TypePointer Type::commonType(Type const* _a, Type const* _b)
|
||||
Type const* Type::commonType(Type const* _a, Type const* _b)
|
||||
{
|
||||
if (!_a || !_b)
|
||||
return nullptr;
|
||||
@@ -301,9 +301,9 @@ MemberList const& Type::members(ASTNode const* _currentScope) const
|
||||
return *m_members[_currentScope];
|
||||
}
|
||||
|
||||
TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) const
|
||||
Type const* Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) const
|
||||
{
|
||||
TypePointer encodingType = mobileType();
|
||||
Type const* encodingType = mobileType();
|
||||
if (encodingType)
|
||||
encodingType = encodingType->interfaceType(_inLibraryCall);
|
||||
if (encodingType)
|
||||
@@ -313,7 +313,7 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c
|
||||
// - storage struct for a library
|
||||
if (_inLibraryCall && encodingType && encodingType->dataStoredIn(DataLocation::Storage))
|
||||
return encodingType;
|
||||
TypePointer baseType = encodingType;
|
||||
Type const* baseType = encodingType;
|
||||
while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType))
|
||||
{
|
||||
baseType = arrayType->baseType();
|
||||
@@ -969,7 +969,7 @@ BoolResult RationalNumberType::isExplicitlyConvertibleTo(Type const& _convertTo)
|
||||
if (isNegative() || isFractional() || m_value >= enumType->numberOfMembers())
|
||||
return false;
|
||||
|
||||
TypePointer mobType = mobileType();
|
||||
Type const* mobType = mobileType();
|
||||
return (mobType && mobType->isExplicitlyConvertibleTo(_convertTo));
|
||||
|
||||
}
|
||||
@@ -1028,8 +1028,8 @@ TypeResult RationalNumberType::binaryOperatorResult(Token _operator, Type const*
|
||||
// Since we do not have a "BoolConstantType", we have to do the actual comparison
|
||||
// at runtime and convert to mobile typse first. Such a comparison is not a very common
|
||||
// use-case and will be optimized away.
|
||||
TypePointer thisMobile = mobileType();
|
||||
TypePointer otherMobile = other.mobileType();
|
||||
Type const* thisMobile = mobileType();
|
||||
Type const* otherMobile = other.mobileType();
|
||||
if (!thisMobile || !otherMobile)
|
||||
return nullptr;
|
||||
return thisMobile->binaryOperatorResult(_operator, otherMobile);
|
||||
@@ -1116,7 +1116,7 @@ u256 RationalNumberType::literalValue(Literal const*) const
|
||||
return value;
|
||||
}
|
||||
|
||||
TypePointer RationalNumberType::mobileType() const
|
||||
Type const* RationalNumberType::mobileType() const
|
||||
{
|
||||
if (!isFractional())
|
||||
return integerType();
|
||||
@@ -1245,7 +1245,7 @@ std::string StringLiteralType::toString(bool) const
|
||||
("literal_string hex\"" + util::toHex(util::asBytes(m_value)) + "\"");
|
||||
}
|
||||
|
||||
TypePointer StringLiteralType::mobileType() const
|
||||
Type const* StringLiteralType::mobileType() const
|
||||
{
|
||||
return TypeProvider::stringMemory();
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ bool ReferenceType::isPointer() const
|
||||
return true;
|
||||
}
|
||||
|
||||
TypePointer ReferenceType::copyForLocationIfReference(Type const* _type) const
|
||||
Type const* ReferenceType::copyForLocationIfReference(Type const* _type) const
|
||||
{
|
||||
return TypeProvider::withLocationIfReference(m_location, _type);
|
||||
}
|
||||
@@ -1729,7 +1729,7 @@ u256 ArrayType::storageSize() const
|
||||
return max<u256>(1, u256(size));
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> ArrayType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> ArrayType::makeStackItems() const
|
||||
{
|
||||
switch (m_location)
|
||||
{
|
||||
@@ -1833,7 +1833,7 @@ MemberList::MemberMap ArrayType::nativeMembers(ASTNode const*) const
|
||||
return members;
|
||||
}
|
||||
|
||||
TypePointer ArrayType::encodingType() const
|
||||
Type const* ArrayType::encodingType() const
|
||||
{
|
||||
if (location() == DataLocation::Storage)
|
||||
return TypeProvider::uint256();
|
||||
@@ -1841,7 +1841,7 @@ TypePointer ArrayType::encodingType() const
|
||||
return TypeProvider::withLocation(this, DataLocation::Memory, true);
|
||||
}
|
||||
|
||||
TypePointer ArrayType::decodingType() const
|
||||
Type const* ArrayType::decodingType() const
|
||||
{
|
||||
if (location() == DataLocation::Storage)
|
||||
return TypeProvider::uint256();
|
||||
@@ -1857,7 +1857,7 @@ TypeResult ArrayType::interfaceType(bool _inLibrary) const
|
||||
if (!_inLibrary && m_interfaceType.has_value())
|
||||
return *m_interfaceType;
|
||||
|
||||
TypeResult result{TypePointer{}};
|
||||
TypeResult result{nullptr};
|
||||
TypeResult baseInterfaceType = m_baseType->interfaceType(_inLibrary);
|
||||
|
||||
if (!baseInterfaceType.get())
|
||||
@@ -1946,7 +1946,7 @@ string ArraySliceType::toString(bool _short) const
|
||||
return m_arrayType.toString(_short) + " slice";
|
||||
}
|
||||
|
||||
TypePointer ArraySliceType::mobileType() const
|
||||
Type const* ArraySliceType::mobileType() const
|
||||
{
|
||||
if (
|
||||
m_arrayType.dataStoredIn(DataLocation::CallData) &&
|
||||
@@ -1959,7 +1959,7 @@ TypePointer ArraySliceType::mobileType() const
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::tuple<std::string, TypePointer>> ArraySliceType::makeStackItems() const
|
||||
std::vector<std::tuple<std::string, Type const*>> ArraySliceType::makeStackItems() const
|
||||
{
|
||||
return {{"offset", TypeProvider::uint256()}, {"length", TypeProvider::uint256()}};
|
||||
}
|
||||
@@ -2041,7 +2041,7 @@ vector<VariableDeclaration const*> ContractType::immutableVariables() const
|
||||
return variables;
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> ContractType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> ContractType::makeStackItems() const
|
||||
{
|
||||
if (m_super)
|
||||
return {};
|
||||
@@ -2184,7 +2184,7 @@ bool StructType::containsNestedMapping() const
|
||||
{
|
||||
for (auto const& member: _struct->members())
|
||||
{
|
||||
TypePointer memberType = member->annotation().type;
|
||||
Type const* memberType = member->annotation().type;
|
||||
solAssert(memberType, "");
|
||||
|
||||
if (auto arrayType = dynamic_cast<ArrayType const*>(memberType))
|
||||
@@ -2220,7 +2220,7 @@ MemberList::MemberMap StructType::nativeMembers(ASTNode const*) const
|
||||
MemberList::MemberMap members;
|
||||
for (ASTPointer<VariableDeclaration> const& variable: m_struct.members())
|
||||
{
|
||||
TypePointer type = variable->annotation().type;
|
||||
Type const* type = variable->annotation().type;
|
||||
solAssert(type, "");
|
||||
solAssert(!(location() != DataLocation::Storage && type->containsNestedMapping()), "");
|
||||
members.emplace_back(
|
||||
@@ -2241,7 +2241,7 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
|
||||
m_interfaceType = TypeResult::err("Recursive type not allowed for public or external contract functions.");
|
||||
else
|
||||
{
|
||||
TypeResult result{TypePointer{}};
|
||||
TypeResult result{nullptr};
|
||||
for (ASTPointer<VariableDeclaration> const& member: m_struct.members())
|
||||
{
|
||||
if (!member->annotation().type)
|
||||
@@ -2268,7 +2268,7 @@ TypeResult StructType::interfaceType(bool _inLibrary) const
|
||||
else if (m_interfaceType_library.has_value())
|
||||
return *m_interfaceType_library;
|
||||
|
||||
TypeResult result{TypePointer{}};
|
||||
TypeResult result{nullptr};
|
||||
|
||||
if (recursive() && !(_inLibrary && location() == DataLocation::Storage))
|
||||
return TypeResult::err(
|
||||
@@ -2374,7 +2374,7 @@ string StructType::signatureInExternalFunction(bool _structsByName) const
|
||||
else
|
||||
{
|
||||
TypePointers memberTypes = memoryMemberTypes();
|
||||
auto memberTypeStrings = memberTypes | boost::adaptors::transformed([&](TypePointer _t) -> string
|
||||
auto memberTypeStrings = memberTypes | boost::adaptors::transformed([&](Type const* _t) -> string
|
||||
{
|
||||
solAssert(_t, "Parameter should have external type.");
|
||||
auto t = _t->interfaceType(_structsByName);
|
||||
@@ -2438,7 +2438,7 @@ TypePointers StructType::memoryMemberTypes() const
|
||||
return types;
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> StructType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> StructType::makeStackItems() const
|
||||
{
|
||||
switch (m_location)
|
||||
{
|
||||
@@ -2460,7 +2460,7 @@ vector<Type const*> StructType::decomposition() const
|
||||
return res;
|
||||
}
|
||||
|
||||
TypePointer EnumType::encodingType() const
|
||||
Type const* EnumType::encodingType() const
|
||||
{
|
||||
solAssert(numberOfMembers() <= 256, "");
|
||||
return TypeProvider::uint(8);
|
||||
@@ -2575,9 +2575,9 @@ u256 TupleType::storageSize() const
|
||||
solAssert(false, "Storage size of non-storable tuple type requested.");
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> TupleType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> TupleType::makeStackItems() const
|
||||
{
|
||||
vector<tuple<string, TypePointer>> slots;
|
||||
vector<tuple<string, Type const*>> slots;
|
||||
unsigned i = 1;
|
||||
for (auto const& t: components())
|
||||
{
|
||||
@@ -2588,7 +2588,7 @@ vector<tuple<string, TypePointer>> TupleType::makeStackItems() const
|
||||
return slots;
|
||||
}
|
||||
|
||||
TypePointer TupleType::mobileType() const
|
||||
Type const* TupleType::mobileType() const
|
||||
{
|
||||
TypePointers mobiles;
|
||||
for (auto const& c: components())
|
||||
@@ -2606,7 +2606,7 @@ TypePointer TupleType::mobileType() const
|
||||
return TypeProvider::tuple(move(mobiles));
|
||||
}
|
||||
|
||||
TypePointer TupleType::closestTemporaryType(Type const* _targetType) const
|
||||
Type const* TupleType::closestTemporaryType(Type const* _targetType) const
|
||||
{
|
||||
solAssert(!!_targetType, "");
|
||||
TypePointers const& targetComponents = dynamic_cast<TupleType const&>(*_targetType).components();
|
||||
@@ -3051,9 +3051,9 @@ bool FunctionType::nameable() const
|
||||
!m_saltSet;
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> FunctionType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> FunctionType::makeStackItems() const
|
||||
{
|
||||
vector<tuple<string, TypePointer>> slots;
|
||||
vector<tuple<string, Type const*>> slots;
|
||||
Kind kind = m_kind;
|
||||
if (m_kind == Kind::SetGas || m_kind == Kind::SetValue)
|
||||
{
|
||||
@@ -3234,7 +3234,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ASTNode const* _scope) const
|
||||
}
|
||||
}
|
||||
|
||||
TypePointer FunctionType::encodingType() const
|
||||
Type const* FunctionType::encodingType() const
|
||||
{
|
||||
if (m_gasSet || m_valueSet)
|
||||
return nullptr;
|
||||
@@ -3253,7 +3253,7 @@ TypeResult FunctionType::interfaceType(bool /*_inLibrary*/) const
|
||||
return TypeResult::err("Internal type is not allowed for public or external functions.");
|
||||
}
|
||||
|
||||
TypePointer FunctionType::mobileType() const
|
||||
Type const* FunctionType::mobileType() const
|
||||
{
|
||||
if (m_valueSet || m_gasSet || m_saltSet || m_bound)
|
||||
return nullptr;
|
||||
@@ -3411,7 +3411,7 @@ string FunctionType::externalSignature() const
|
||||
|
||||
solAssert(extParams.message().empty(), extParams.message());
|
||||
|
||||
auto typeStrings = extParams.get() | boost::adaptors::transformed([&](TypePointer _t) -> string
|
||||
auto typeStrings = extParams.get() | boost::adaptors::transformed([&](Type const* _t) -> string
|
||||
{
|
||||
string typeName = _t->signatureInExternalFunction(inLibrary);
|
||||
|
||||
@@ -3461,7 +3461,7 @@ TypePointers FunctionType::parseElementaryTypeVector(strings const& _types)
|
||||
return pointers;
|
||||
}
|
||||
|
||||
TypePointer FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bool _setSalt) const
|
||||
Type const* FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bool _setSalt) const
|
||||
{
|
||||
solAssert(m_kind != Kind::Declaration, "");
|
||||
return TypeProvider::function(
|
||||
@@ -3651,7 +3651,7 @@ u256 TypeType::storageSize() const
|
||||
solAssert(false, "Storage size of non-storable type type requested.");
|
||||
}
|
||||
|
||||
vector<tuple<string, TypePointer>> TypeType::makeStackItems() const
|
||||
vector<tuple<string, Type const*>> TypeType::makeStackItems() const
|
||||
{
|
||||
if (auto contractType = dynamic_cast<ContractType const*>(m_actualType))
|
||||
if (contractType->contractDefinition().isLibrary())
|
||||
@@ -3982,14 +3982,14 @@ string MagicType::toString(bool _short) const
|
||||
return {};
|
||||
}
|
||||
|
||||
TypePointer MagicType::typeArgument() const
|
||||
Type const* MagicType::typeArgument() const
|
||||
{
|
||||
solAssert(m_kind == Kind::MetaType, "");
|
||||
solAssert(m_typeArgument, "");
|
||||
return m_typeArgument;
|
||||
}
|
||||
|
||||
TypePointer InaccessibleDynamicType::decodingType() const
|
||||
Type const* InaccessibleDynamicType::decodingType() const
|
||||
{
|
||||
return TypeProvider::integer(256, IntegerType::Modifier::Unsigned);
|
||||
}
|
||||
|
||||
+53
-54
@@ -48,11 +48,10 @@ namespace solidity::frontend
|
||||
class TypeProvider;
|
||||
class Type; // forward
|
||||
class FunctionType; // forward
|
||||
using TypePointer = Type const*;
|
||||
using FunctionTypePointer = FunctionType const*;
|
||||
using TypePointers = std::vector<TypePointer>;
|
||||
using TypePointers = std::vector<Type const*>;
|
||||
using rational = boost::rational<bigint>;
|
||||
using TypeResult = util::Result<TypePointer>;
|
||||
using TypeResult = util::Result<Type const*>;
|
||||
using BoolResult = util::Result<bool>;
|
||||
|
||||
}
|
||||
@@ -122,9 +121,9 @@ public:
|
||||
explicit MemberList(MemberMap _members): m_memberTypes(std::move(_members)) {}
|
||||
|
||||
void combine(MemberList const& _other);
|
||||
TypePointer memberType(std::string const& _name) const
|
||||
Type const* memberType(std::string const& _name) const
|
||||
{
|
||||
TypePointer type = nullptr;
|
||||
Type const* type = nullptr;
|
||||
for (auto const& it: m_memberTypes)
|
||||
if (it.name == _name)
|
||||
{
|
||||
@@ -181,7 +180,7 @@ public:
|
||||
};
|
||||
|
||||
/// @returns a pointer to _a or _b if the other is implicitly convertible to it or nullptr otherwise
|
||||
static TypePointer commonType(Type const* _a, Type const* _b);
|
||||
static Type const* commonType(Type const* _a, Type const* _b);
|
||||
|
||||
virtual Category category() const = 0;
|
||||
/// @returns a valid solidity identifier such that two types should compare equal if and
|
||||
@@ -292,7 +291,7 @@ public:
|
||||
/// The complete layout of a type on the stack can be obtained from its stack items recursively as follows:
|
||||
/// - Each unnamed stack item is untyped (its type is ``nullptr``) and contributes exactly one stack slot.
|
||||
/// - Each named stack item is typed and contributes the stack slots given by the stack items of its type.
|
||||
std::vector<std::tuple<std::string, TypePointer>> const& stackItems() const
|
||||
std::vector<std::tuple<std::string, Type const*>> const& stackItems() const
|
||||
{
|
||||
if (!m_stackItems)
|
||||
m_stackItems = makeStackItems();
|
||||
@@ -321,14 +320,14 @@ public:
|
||||
/// This returns the corresponding IntegerType or FixedPointType for RationalNumberType
|
||||
/// and the pointer type for storage reference types.
|
||||
/// Might return a null pointer if there is no fitting type.
|
||||
virtual TypePointer mobileType() const { return this; }
|
||||
virtual Type const* mobileType() const { return this; }
|
||||
/// @returns true if this is a non-value type and the data of this type is stored at the
|
||||
/// given location.
|
||||
virtual bool dataStoredIn(DataLocation) const { return false; }
|
||||
/// @returns the type of a temporary during assignment to a variable of the given type.
|
||||
/// Specifically, returns the requested itself if it can be dynamically allocated (or is a value type)
|
||||
/// and the mobile type otherwise.
|
||||
virtual TypePointer closestTemporaryType(Type const* _targetType) const
|
||||
virtual Type const* closestTemporaryType(Type const* _targetType) const
|
||||
{
|
||||
return _targetType->dataStoredIn(DataLocation::Storage) ? mobileType() : _targetType;
|
||||
}
|
||||
@@ -337,7 +336,7 @@ public:
|
||||
/// @param _currentScope scope in which the members are accessed.
|
||||
MemberList const& members(ASTNode const* _currentScope) const;
|
||||
/// Convenience method, returns the type of the given named member or an empty pointer if no such member exists.
|
||||
TypePointer memberType(std::string const& _name, ASTNode const* _currentScope = nullptr) const
|
||||
Type const* memberType(std::string const& _name, ASTNode const* _currentScope = nullptr) const
|
||||
{
|
||||
return members(_currentScope).memberType(_name);
|
||||
}
|
||||
@@ -361,14 +360,14 @@ public:
|
||||
/// @returns a (simpler) type that is encoded in the same way for external function calls.
|
||||
/// This for example returns address for contract types.
|
||||
/// If there is no such type, returns an empty shared pointer.
|
||||
virtual TypePointer encodingType() const { return nullptr; }
|
||||
virtual Type const* encodingType() const { return nullptr; }
|
||||
/// @returns the encoding type used under the given circumstances for the type of an expression
|
||||
/// when used for e.g. abi.encode(...) or the empty pointer if the object
|
||||
/// cannot be encoded.
|
||||
/// This is different from encodingType since it takes implicit conversions into account.
|
||||
TypePointer fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool _packed) const;
|
||||
Type const* fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool _packed) const;
|
||||
/// @returns a (simpler) type that is used when decoding this type in calldata.
|
||||
virtual TypePointer decodingType() const { return encodingType(); }
|
||||
virtual Type const* decodingType() const { return encodingType(); }
|
||||
/// @returns a type that will be used outside of Solidity for e.g. function signatures.
|
||||
/// This for example returns address for contract types.
|
||||
/// If there is no such type, returns an empty shared pointer.
|
||||
@@ -392,7 +391,7 @@ protected:
|
||||
}
|
||||
/// Generates the stack items to be returned by ``stackItems()``. Defaults
|
||||
/// to exactly one unnamed and untyped stack item referring to a single stack slot.
|
||||
virtual std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const
|
||||
virtual std::vector<std::tuple<std::string, Type const*>> makeStackItems() const
|
||||
{
|
||||
return {std::make_tuple(std::string(), nullptr)};
|
||||
}
|
||||
@@ -400,7 +399,7 @@ protected:
|
||||
|
||||
/// List of member types (parameterised by scape), will be lazy-initialized.
|
||||
mutable std::map<ASTNode const*, std::unique_ptr<MemberList>> m_members;
|
||||
mutable std::optional<std::vector<std::tuple<std::string, TypePointer>>> m_stackItems;
|
||||
mutable std::optional<std::vector<std::tuple<std::string, Type const*>>> m_stackItems;
|
||||
mutable std::optional<size_t> m_stackSize;
|
||||
};
|
||||
|
||||
@@ -435,7 +434,7 @@ public:
|
||||
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
|
||||
TypePointer encodingType() const override { return this; }
|
||||
Type const* encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
|
||||
StateMutability stateMutability(void) const { return m_stateMutability; }
|
||||
@@ -475,7 +474,7 @@ public:
|
||||
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
TypePointer encodingType() const override { return this; }
|
||||
Type const* encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
|
||||
unsigned numBits() const { return m_bits; }
|
||||
@@ -522,7 +521,7 @@ public:
|
||||
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
TypePointer encodingType() const override { return this; }
|
||||
Type const* encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
|
||||
/// Number of bits used for this type in total.
|
||||
@@ -572,7 +571,7 @@ public:
|
||||
|
||||
std::string toString(bool _short) const override;
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
TypePointer mobileType() const override;
|
||||
Type const* mobileType() const override;
|
||||
|
||||
/// @returns the underlying raw literal value.
|
||||
///
|
||||
@@ -603,7 +602,7 @@ private:
|
||||
|
||||
/// Bytes type to which the rational can be explicitly converted.
|
||||
/// Empty for all rationals that are not directly parsed from hex literals.
|
||||
TypePointer m_compatibleBytesType;
|
||||
Type const* m_compatibleBytesType;
|
||||
|
||||
/// @returns true if the literal is a valid rational number.
|
||||
static std::tuple<bool, rational> parseRational(std::string const& _value);
|
||||
@@ -636,12 +635,12 @@ public:
|
||||
bool canBeStored() const override { return false; }
|
||||
|
||||
std::string toString(bool) const override;
|
||||
TypePointer mobileType() const override;
|
||||
Type const* mobileType() const override;
|
||||
|
||||
std::string const& value() const { return m_value; }
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override { return {}; }
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
|
||||
private:
|
||||
std::string m_value;
|
||||
};
|
||||
@@ -671,7 +670,7 @@ public:
|
||||
|
||||
std::string toString(bool) const override { return "bytes" + util::toString(m_bytes); }
|
||||
MemberList::MemberMap nativeMembers(ASTNode const*) const override;
|
||||
TypePointer encodingType() const override { return this; }
|
||||
Type const* encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
|
||||
unsigned numBytes() const { return m_bytes; }
|
||||
@@ -699,7 +698,7 @@ public:
|
||||
|
||||
std::string toString(bool) const override { return "bool"; }
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
TypePointer encodingType() const override { return this; }
|
||||
Type const* encodingType() const override { return this; }
|
||||
TypeResult interfaceType(bool) const override { return this; }
|
||||
};
|
||||
|
||||
@@ -756,7 +755,7 @@ public:
|
||||
/// whereas isPointer is only shallowly changed - the deep copy is always a bound reference.
|
||||
virtual std::unique_ptr<ReferenceType> copyForLocation(DataLocation _location, bool _isPointer) const = 0;
|
||||
|
||||
TypePointer mobileType() const override { return withLocation(m_location, true); }
|
||||
Type const* mobileType() const override { return withLocation(m_location, true); }
|
||||
bool dataStoredIn(DataLocation _location) const override { return m_location == _location; }
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
|
||||
@@ -838,8 +837,8 @@ public:
|
||||
std::string canonicalName() const override;
|
||||
std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override;
|
||||
TypePointer encodingType() const override;
|
||||
TypePointer decodingType() const override;
|
||||
Type const* encodingType() const override;
|
||||
Type const* decodingType() const override;
|
||||
TypeResult interfaceType(bool _inLibrary) const override;
|
||||
|
||||
BoolResult validForLocation(DataLocation _loc) const override;
|
||||
@@ -865,7 +864,7 @@ public:
|
||||
void clearCache() const override;
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
std::vector<Type const*> decomposition() const override { return {m_baseType}; }
|
||||
|
||||
private:
|
||||
@@ -897,7 +896,7 @@ public:
|
||||
bool isDynamicallySized() const override { return true; }
|
||||
bool isDynamicallyEncoded() const override { return true; }
|
||||
std::string toString(bool _short) const override;
|
||||
TypePointer mobileType() const override;
|
||||
Type const* mobileType() const override;
|
||||
|
||||
BoolResult validForLocation(DataLocation _loc) const override { return m_arrayType.validForLocation(_loc); }
|
||||
|
||||
@@ -907,7 +906,7 @@ public:
|
||||
std::unique_ptr<ReferenceType> copyForLocation(DataLocation, bool) const override { solAssert(false, ""); }
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
std::vector<Type const*> decomposition() const override { return {m_arrayType.baseType()}; }
|
||||
|
||||
private:
|
||||
@@ -972,7 +971,7 @@ public:
|
||||
/// @returns a list of all immutable variables (including inherited) of the contract.
|
||||
std::vector<VariableDeclaration const*> immutableVariables() const;
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
private:
|
||||
ContractDefinition const& m_contract;
|
||||
/// If true, this is a special "super" type of m_contract containing only members that m_contract inherited
|
||||
@@ -1034,7 +1033,7 @@ public:
|
||||
void clearCache() const override;
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
std::vector<Type const*> decomposition() const override;
|
||||
|
||||
private:
|
||||
@@ -1068,7 +1067,7 @@ public:
|
||||
bool nameable() const override { return true; }
|
||||
|
||||
BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer encodingType() const override;
|
||||
Type const* encodingType() const override;
|
||||
TypeResult interfaceType(bool _inLibrary) const override
|
||||
{
|
||||
return _inLibrary ? this : encodingType();
|
||||
@@ -1090,7 +1089,7 @@ private:
|
||||
class TupleType: public CompositeType
|
||||
{
|
||||
public:
|
||||
explicit TupleType(std::vector<TypePointer> _types = {}): m_components(std::move(_types)) {}
|
||||
explicit TupleType(std::vector<Type const*> _types = {}): m_components(std::move(_types)) {}
|
||||
|
||||
Category category() const override { return Category::Tuple; }
|
||||
|
||||
@@ -1102,14 +1101,14 @@ public:
|
||||
bool canBeStored() const override { return false; }
|
||||
u256 storageSize() const override;
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
TypePointer mobileType() const override;
|
||||
Type const* mobileType() const override;
|
||||
/// Converts components to their temporary types and performs some wildcard matching.
|
||||
TypePointer closestTemporaryType(Type const* _targetType) const override;
|
||||
Type const* closestTemporaryType(Type const* _targetType) const override;
|
||||
|
||||
std::vector<TypePointer> const& components() const { return m_components; }
|
||||
std::vector<Type const*> const& components() const { return m_components; }
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
std::vector<Type const*> decomposition() const override
|
||||
{
|
||||
// Currently calling TupleType::decomposition() is not expected, because we cannot declare a variable of a tuple type.
|
||||
@@ -1121,7 +1120,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<TypePointer> const m_components;
|
||||
std::vector<Type const*> const m_components;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1278,11 +1277,11 @@ public:
|
||||
bool nameable() const override;
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override;
|
||||
TypePointer encodingType() const override;
|
||||
Type const* encodingType() const override;
|
||||
TypeResult interfaceType(bool _inLibrary) const override;
|
||||
TypePointer mobileType() const override;
|
||||
Type const* mobileType() const override;
|
||||
|
||||
/// @returns TypePointer of a new FunctionType object. All input/return parameters are an
|
||||
/// @returns Type const* of a new FunctionType object. All input/return parameters are an
|
||||
/// appropriate external types (i.e. the interfaceType()s) of input/return parameters of
|
||||
/// current function.
|
||||
/// @returns an empty shared pointer if one of the input/return parameters does not have an
|
||||
@@ -1360,7 +1359,7 @@ public:
|
||||
|
||||
/// @returns a copy of this type, where gas or value are set manually. This will never set one
|
||||
/// of the parameters to false.
|
||||
TypePointer copyAndSetCallOptions(bool _setGas, bool _setValue, bool _setSalt) const;
|
||||
Type const* copyAndSetCallOptions(bool _setGas, bool _setValue, bool _setSalt) const;
|
||||
|
||||
/// @returns a copy of this function type with the `bound` flag set to true.
|
||||
/// Should only be called on library functions.
|
||||
@@ -1374,7 +1373,7 @@ public:
|
||||
FunctionTypePointer asExternallyCallableFunction(bool _inLibrary) const;
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
private:
|
||||
static TypePointers parseElementaryTypeVector(strings const& _types);
|
||||
|
||||
@@ -1427,8 +1426,8 @@ protected:
|
||||
std::vector<Type const*> decomposition() const override { return {m_valueType}; }
|
||||
|
||||
private:
|
||||
TypePointer m_keyType;
|
||||
TypePointer m_valueType;
|
||||
Type const* m_keyType;
|
||||
Type const* m_valueType;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1455,9 +1454,9 @@ public:
|
||||
|
||||
BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override;
|
||||
private:
|
||||
TypePointer m_actualType;
|
||||
Type const* m_actualType;
|
||||
};
|
||||
|
||||
|
||||
@@ -1479,7 +1478,7 @@ public:
|
||||
bool operator==(Type const& _other) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override { return {}; }
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
|
||||
private:
|
||||
TypePointers m_parameterTypes;
|
||||
};
|
||||
@@ -1506,7 +1505,7 @@ public:
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override { return {}; }
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
|
||||
private:
|
||||
SourceUnit const& m_sourceUnit;
|
||||
};
|
||||
@@ -1546,14 +1545,14 @@ public:
|
||||
|
||||
Kind kind() const { return m_kind; }
|
||||
|
||||
TypePointer typeArgument() const;
|
||||
Type const* typeArgument() const;
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override { return {}; }
|
||||
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
|
||||
private:
|
||||
Kind m_kind;
|
||||
/// Contract type used for contract metadata magic.
|
||||
TypePointer m_typeArgument;
|
||||
Type const* m_typeArgument;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1574,7 +1573,7 @@ public:
|
||||
bool isValueType() const override { return true; }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
std::string toString(bool) const override { return "inaccessible dynamic type"; }
|
||||
TypePointer decodingType() const override;
|
||||
Type const* decodingType() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user