mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Typo in EnumValue
This commit is contained in:
parent
fb4ff4af28
commit
b20ce4451b
8
AST.cpp
8
AST.cpp
@ -206,7 +206,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getIn
|
||||
return *m_interfaceFunctionList;
|
||||
}
|
||||
|
||||
TypePointer EnumvValue::getType(ContractDefinition const*) const
|
||||
TypePointer EnumValue::getType(ContractDefinition const*) const
|
||||
{
|
||||
EnumDefinition const* parentDef = dynamic_cast<EnumDefinition const*>(getScope());
|
||||
return make_shared<EnumType>(*parentDef);
|
||||
@ -263,8 +263,8 @@ void StructDefinition::checkRecursion() const
|
||||
|
||||
void EnumDefinition::checkValidityOfMembers() const
|
||||
{
|
||||
vector<ASTPointer<EnumvValue>> members(getMembers());
|
||||
auto compareDecls = [](ASTPointer<EnumvValue> a, ASTPointer<EnumvValue> b)
|
||||
vector<ASTPointer<EnumValue>> members(getMembers());
|
||||
auto compareDecls = [](ASTPointer<EnumValue> a, ASTPointer<EnumValue> b)
|
||||
{
|
||||
return a->getName() < b->getName();
|
||||
};
|
||||
@ -283,7 +283,7 @@ TypePointer EnumDefinition::getType(ContractDefinition const*) const
|
||||
unsigned int EnumDefinition::getMemberValue(ASTString const& _member) const
|
||||
{
|
||||
unsigned int index = 0;
|
||||
for (ASTPointer<EnumvValue> const& decl: m_members)
|
||||
for (ASTPointer<EnumValue> const& decl: m_members)
|
||||
{
|
||||
if (decl->getName() == _member)
|
||||
return index;
|
||||
|
10
AST.h
10
AST.h
@ -168,10 +168,10 @@ private:
|
||||
/**
|
||||
* Declaration of an Enum Value
|
||||
*/
|
||||
class EnumvValue : public Declaration
|
||||
class EnumValue: public Declaration
|
||||
{
|
||||
public:
|
||||
EnumvValue(Location const& _location,
|
||||
EnumValue(Location const& _location,
|
||||
ASTPointer<ASTString> const& _name):
|
||||
Declaration(_location, _name) {}
|
||||
|
||||
@ -339,12 +339,12 @@ class EnumDefinition: public Declaration
|
||||
public:
|
||||
EnumDefinition(Location const& _location,
|
||||
ASTPointer<ASTString> const& _name,
|
||||
std::vector<ASTPointer<EnumvValue>> const& _members):
|
||||
std::vector<ASTPointer<EnumValue>> const& _members):
|
||||
Declaration(_location, _name), m_members(_members) {}
|
||||
virtual void accept(ASTVisitor& _visitor) override;
|
||||
virtual void accept(ASTConstVisitor& _visitor) const override;
|
||||
|
||||
std::vector<ASTPointer<EnumvValue>> const& getMembers() const { return m_members; }
|
||||
std::vector<ASTPointer<EnumValue>> const& getMembers() const { return m_members; }
|
||||
|
||||
virtual TypePointer getType(ContractDefinition const*) const override;
|
||||
|
||||
@ -356,7 +356,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
std::vector<ASTPointer<EnumvValue>> m_members;
|
||||
std::vector<ASTPointer<EnumValue>> m_members;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ class ContractDefinition;
|
||||
class InheritanceSpecifier;
|
||||
class StructDefinition;
|
||||
class EnumDefinition;
|
||||
class EnumvValue;
|
||||
class EnumValue;
|
||||
class ParameterList;
|
||||
class FunctionDefinition;
|
||||
class VariableDeclaration;
|
||||
|
@ -77,7 +77,7 @@ bool ASTPrinter::visit(EnumDefinition const& _node)
|
||||
return goDeeper();
|
||||
}
|
||||
|
||||
bool ASTPrinter::visit(EnumvValue const& _node)
|
||||
bool ASTPrinter::visit(EnumValue const& _node)
|
||||
{
|
||||
writeLine("EnumValue \"" + _node.getName() + "\"");
|
||||
return goDeeper();
|
||||
@ -364,7 +364,7 @@ void ASTPrinter::endVisit(EnumDefinition const&)
|
||||
m_indentation--;
|
||||
}
|
||||
|
||||
void ASTPrinter::endVisit(EnumvValue const&)
|
||||
void ASTPrinter::endVisit(EnumValue const&)
|
||||
{
|
||||
m_indentation--;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
bool visit(InheritanceSpecifier const& _node) override;
|
||||
bool visit(StructDefinition const& _node) override;
|
||||
bool visit(EnumDefinition const& _node) override;
|
||||
bool visit(EnumvValue const& _node) override;
|
||||
bool visit(EnumValue const& _node) override;
|
||||
bool visit(ParameterList const& _node) override;
|
||||
bool visit(FunctionDefinition const& _node) override;
|
||||
bool visit(VariableDeclaration const& _node) override;
|
||||
@ -88,7 +88,7 @@ public:
|
||||
void endVisit(InheritanceSpecifier const&) override;
|
||||
void endVisit(StructDefinition const&) override;
|
||||
void endVisit(EnumDefinition const&) override;
|
||||
void endVisit(EnumvValue const&) override;
|
||||
void endVisit(EnumValue const&) override;
|
||||
void endVisit(ParameterList const&) override;
|
||||
void endVisit(FunctionDefinition const&) override;
|
||||
void endVisit(VariableDeclaration const&) override;
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
virtual bool visit(InheritanceSpecifier&) { return true; }
|
||||
virtual bool visit(StructDefinition&) { return true; }
|
||||
virtual bool visit(EnumDefinition&) { return true; }
|
||||
virtual bool visit(EnumvValue&) { return true; }
|
||||
virtual bool visit(EnumValue&) { return true; }
|
||||
virtual bool visit(ParameterList&) { return true; }
|
||||
virtual bool visit(FunctionDefinition&) { return true; }
|
||||
virtual bool visit(VariableDeclaration&) { return true; }
|
||||
@ -91,7 +91,7 @@ public:
|
||||
virtual void endVisit(InheritanceSpecifier&) { }
|
||||
virtual void endVisit(StructDefinition&) { }
|
||||
virtual void endVisit(EnumDefinition&) { }
|
||||
virtual void endVisit(EnumvValue&) { }
|
||||
virtual void endVisit(EnumValue&) { }
|
||||
virtual void endVisit(ParameterList&) { }
|
||||
virtual void endVisit(FunctionDefinition&) { }
|
||||
virtual void endVisit(VariableDeclaration&) { }
|
||||
@ -138,7 +138,7 @@ public:
|
||||
virtual bool visit(InheritanceSpecifier const&) { return true; }
|
||||
virtual bool visit(StructDefinition const&) { return true; }
|
||||
virtual bool visit(EnumDefinition const&) { return true; }
|
||||
virtual bool visit(EnumvValue const&) { return true; }
|
||||
virtual bool visit(EnumValue const&) { return true; }
|
||||
virtual bool visit(ParameterList const&) { return true; }
|
||||
virtual bool visit(FunctionDefinition const&) { return true; }
|
||||
virtual bool visit(VariableDeclaration const&) { return true; }
|
||||
@ -181,7 +181,7 @@ public:
|
||||
virtual void endVisit(InheritanceSpecifier const&) { }
|
||||
virtual void endVisit(StructDefinition const&) { }
|
||||
virtual void endVisit(EnumDefinition const&) { }
|
||||
virtual void endVisit(EnumvValue const&) { }
|
||||
virtual void endVisit(EnumValue const&) { }
|
||||
virtual void endVisit(ParameterList const&) { }
|
||||
virtual void endVisit(FunctionDefinition const&) { }
|
||||
virtual void endVisit(VariableDeclaration const&) { }
|
||||
|
@ -121,13 +121,13 @@ void EnumDefinition::accept(ASTConstVisitor& _visitor) const
|
||||
_visitor.endVisit(*this);
|
||||
}
|
||||
|
||||
void EnumvValue::accept(ASTVisitor& _visitor)
|
||||
void EnumValue::accept(ASTVisitor& _visitor)
|
||||
{
|
||||
_visitor.visit(*this);
|
||||
_visitor.endVisit(*this);
|
||||
}
|
||||
|
||||
void EnumvValue::accept(ASTConstVisitor& _visitor) const
|
||||
void EnumValue::accept(ASTConstVisitor& _visitor) const
|
||||
{
|
||||
_visitor.visit(*this);
|
||||
_visitor.endVisit(*this);
|
||||
|
@ -266,12 +266,12 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition()
|
||||
return nodeFactory.createNode<StructDefinition>(name, members);
|
||||
}
|
||||
|
||||
ASTPointer<EnumvValue> Parser::parseEnumDeclaration()
|
||||
ASTPointer<EnumValue> Parser::parseEnumDeclaration()
|
||||
{
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
ASTPointer<ASTString> name = expectIdentifierToken();
|
||||
nodeFactory.markEndPosition();
|
||||
return nodeFactory.createNode<EnumvValue>(name);
|
||||
return nodeFactory.createNode<EnumValue>(name);
|
||||
}
|
||||
|
||||
ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
|
||||
@ -279,7 +279,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
expectToken(Token::Enum);
|
||||
ASTPointer<ASTString> name = expectIdentifierToken();
|
||||
vector<ASTPointer<EnumvValue>> members;
|
||||
vector<ASTPointer<EnumValue>> members;
|
||||
expectToken(Token::LBrace);
|
||||
|
||||
while (m_scanner->getCurrentToken() != Token::RBrace)
|
||||
|
2
Parser.h
2
Parser.h
@ -62,7 +62,7 @@ private:
|
||||
ASTPointer<FunctionDefinition> parseFunctionDefinition(ASTString const* _contractName);
|
||||
ASTPointer<StructDefinition> parseStructDefinition();
|
||||
ASTPointer<EnumDefinition> parseEnumDefinition();
|
||||
ASTPointer<EnumvValue> parseEnumDeclaration();
|
||||
ASTPointer<EnumValue> parseEnumDeclaration();
|
||||
ASTPointer<VariableDeclaration> parseVariableDeclaration(VarDeclParserOptions const& _options = VarDeclParserOptions());
|
||||
ASTPointer<ModifierDefinition> parseModifierDefinition();
|
||||
ASTPointer<EventDefinition> parseEventDefinition();
|
||||
|
@ -952,7 +952,7 @@ MemberList const& TypeType::getMembers() const
|
||||
else if (m_actualType->getCategory() == Category::Enum)
|
||||
{
|
||||
EnumDefinition const& enumDef = dynamic_cast<EnumType const&>(*m_actualType).getEnumDefinition();
|
||||
for (ASTPointer<EnumvValue> const& enumValue: enumDef.getMembers())
|
||||
for (ASTPointer<EnumValue> const& enumValue: enumDef.getMembers())
|
||||
members.insert(make_pair(enumValue->getName(), make_shared<EnumType>(enumDef)));
|
||||
m_members.reset(new MemberList(members));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user