Merge pull request #8106 from random-internet-cat/move-contract-kind

Move ContractKind from ContractDefinition to file-scope
This commit is contained in:
chriseth
2020-01-08 13:06:26 +01:00
committed by GitHub
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
@@ -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;
+2
View File
@@ -67,4 +67,6 @@ struct FuncCallArguments
bool hasNamedArguments() const { return !names.empty(); }
};
enum class ContractKind { Interface, Contract, Library };
}
+4 -4
View File
@@ -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";
}
+1 -1
View File
@@ -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);