Move ContractKind from ContractDefinition to file-scope

This commit is contained in:
Jason Cobb
2020-01-07 09:11:29 -05:00
parent f7624e254c
commit 529405deb6
11 changed files with 27 additions and 27 deletions
+1 -1
View File
@@ -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.");
+1 -3
View File
@@ -378,8 +378,6 @@ protected:
class ContractDefinition: public Declaration, public Documented
{
public:
enum class ContractKind { Interface, Contract, Library };
ContractDefinition(
SourceLocation const& _location,
ASTPointer<ASTString> const& _name,
@@ -711,7 +709,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;
+2
View File
@@ -69,5 +69,7 @@ struct FuncCallArguments
bool hasNamedArguments() const { return !names.empty(); }
};
enum class ContractKind { Interface, Contract, Library };
}
}
+4 -4
View File
@@ -834,15 +834,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";
}
+1 -1
View File
@@ -147,7 +147,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);