mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8106 from random-internet-cat/move-contract-kind
Move ContractKind from ContractDefinition to file-scope
This commit is contained in:
@@ -305,7 +305,7 @@ TypeDeclarationAnnotation& EnumDefinition::annotation() const
|
||||
return dynamic_cast<TypeDeclarationAnnotation&>(*m_annotation);
|
||||
}
|
||||
|
||||
ContractDefinition::ContractKind FunctionDefinition::inContractKind() const
|
||||
ContractKind FunctionDefinition::inContractKind() const
|
||||
{
|
||||
auto contractDef = dynamic_cast<ContractDefinition const*>(scope());
|
||||
solAssert(contractDef, "Enclosing Scope of FunctionDefinition was not set.");
|
||||
|
||||
@@ -376,8 +376,6 @@ protected:
|
||||
class ContractDefinition: public Declaration, public Documented
|
||||
{
|
||||
public:
|
||||
enum class ContractKind { Interface, Contract, Library };
|
||||
|
||||
ContractDefinition(
|
||||
SourceLocation const& _location,
|
||||
ASTPointer<ASTString> const& _name,
|
||||
@@ -709,7 +707,7 @@ public:
|
||||
/// @returns the external identifier of this function (the hash of the signature) as a hex string.
|
||||
std::string externalIdentifierHex() const;
|
||||
|
||||
ContractDefinition::ContractKind inContractKind() const;
|
||||
ContractKind inContractKind() const;
|
||||
|
||||
TypePointer type() const override;
|
||||
|
||||
|
||||
@@ -67,4 +67,6 @@ struct FuncCallArguments
|
||||
bool hasNamedArguments() const { return !names.empty(); }
|
||||
};
|
||||
|
||||
enum class ContractKind { Interface, Contract, Library };
|
||||
|
||||
}
|
||||
|
||||
@@ -832,15 +832,15 @@ string ASTJsonConverter::location(VariableDeclaration::Location _location)
|
||||
return {};
|
||||
}
|
||||
|
||||
string ASTJsonConverter::contractKind(ContractDefinition::ContractKind _kind)
|
||||
string ASTJsonConverter::contractKind(ContractKind _kind)
|
||||
{
|
||||
switch (_kind)
|
||||
{
|
||||
case ContractDefinition::ContractKind::Interface:
|
||||
case ContractKind::Interface:
|
||||
return "interface";
|
||||
case ContractDefinition::ContractKind::Contract:
|
||||
case ContractKind::Contract:
|
||||
return "contract";
|
||||
case ContractDefinition::ContractKind::Library:
|
||||
case ContractKind::Library:
|
||||
return "library";
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ private:
|
||||
}
|
||||
Json::Value inlineAssemblyIdentifierToJson(std::pair<yul::Identifier const* , InlineAssemblyAnnotation::ExternalIdentifierInfo> _info) const;
|
||||
static std::string location(VariableDeclaration::Location _location);
|
||||
static std::string contractKind(ContractDefinition::ContractKind _kind);
|
||||
static std::string contractKind(ContractKind _kind);
|
||||
static std::string functionCallKind(FunctionCallKind _kind);
|
||||
static std::string literalTokenKind(Token _token);
|
||||
static std::string type(Expression const& _expression);
|
||||
|
||||
Reference in New Issue
Block a user