removed unused member

added some comments for ModifierInvocation::checkTypeRequirements
cleanup
This commit is contained in:
Liana Husikyan 2015-03-02 14:21:12 +01:00
parent e9238e15b4
commit 9b6b2759b4
3 changed files with 6 additions and 6 deletions

View File

@ -353,7 +353,7 @@ void ModifierDefinition::checkTypeRequirements()
m_body->checkTypeRequirements(); m_body->checkTypeRequirements();
} }
void ModifierInvocation::checkTypeRequirements(std::vector<ASTPointer<InheritanceSpecifier>> const& _bases) void ModifierInvocation::checkTypeRequirements(vector<ASTPointer<InheritanceSpecifier>> const& _bases)
{ {
m_modifierName->checkTypeRequirements(); m_modifierName->checkTypeRequirements();
for (ASTPointer<Expression> const& argument: m_arguments) for (ASTPointer<Expression> const& argument: m_arguments)
@ -365,12 +365,12 @@ void ModifierInvocation::checkTypeRequirements(std::vector<ASTPointer<Inheritanc
if (auto modifier = dynamic_cast<ModifierDefinition const*>(declaration)) if (auto modifier = dynamic_cast<ModifierDefinition const*>(declaration))
parameters = &modifier->getParameters(); parameters = &modifier->getParameters();
else else
// check parameters for Base constructors
for (auto const& base: _bases) for (auto const& base: _bases)
if (declaration == base->getName()->getReferencedDeclaration()) if (declaration == base->getName()->getReferencedDeclaration())
{ {
m_referencedConstructor = dynamic_cast<ContractDefinition const&>(*declaration).getConstructor(); if (auto referencedConstructor = dynamic_cast<ContractDefinition const&>(*declaration).getConstructor())
if (m_referencedConstructor) parameters = &referencedConstructor->getParameters();
parameters = &m_referencedConstructor->getParameters();
else else
parameters = &emptyParameterList; parameters = &emptyParameterList;
break; break;

2
AST.h
View File

@ -525,12 +525,12 @@ public:
ASTPointer<Identifier> const& getName() const { return m_modifierName; } ASTPointer<Identifier> const& getName() const { return m_modifierName; }
std::vector<ASTPointer<Expression>> const& getArguments() const { return m_arguments; } std::vector<ASTPointer<Expression>> const& getArguments() const { return m_arguments; }
/// @param _bases is the list of base contracts for base constructor calls. For modifiers an empty vector should be passed.
void checkTypeRequirements(std::vector<ASTPointer<InheritanceSpecifier>> const& _bases); void checkTypeRequirements(std::vector<ASTPointer<InheritanceSpecifier>> const& _bases);
private: private:
ASTPointer<Identifier> m_modifierName; ASTPointer<Identifier> m_modifierName;
std::vector<ASTPointer<Expression>> m_arguments; std::vector<ASTPointer<Expression>> m_arguments;
FunctionDefinition const* m_referencedConstructor = nullptr;
}; };
/** /**

View File

@ -126,7 +126,7 @@ eth::AssemblyItem CompilerContext::getSuperFunctionEntryLabel(string const& _nam
FunctionDefinition const* CompilerContext::getNextConstructor(ContractDefinition const& _contract) const FunctionDefinition const* CompilerContext::getNextConstructor(ContractDefinition const& _contract) const
{ {
vector<ContractDefinition const*>::const_iterator it = getSuperContract(_contract); vector<ContractDefinition const*>::const_iterator it = getSuperContract(_contract);
for (; it != m_inheritanceHierarchy.end(); it = getSuperContract(**it)) for (; it != m_inheritanceHierarchy.end(); ++it)
if ((*it)->getConstructor()) if ((*it)->getConstructor())
return (*it)->getConstructor(); return (*it)->getConstructor();