Browse Source

Typo in EnumValue

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
e5ccf5e2be
  1. 8
      libsolidity/AST.cpp
  2. 14
      libsolidity/AST.h
  3. 2
      libsolidity/ASTForward.h
  4. 4
      libsolidity/ASTPrinter.cpp
  5. 4
      libsolidity/ASTPrinter.h
  6. 8
      libsolidity/ASTVisitor.h
  7. 4
      libsolidity/AST_accept.h
  8. 6
      libsolidity/Parser.cpp
  9. 2
      libsolidity/Parser.h
  10. 2
      libsolidity/Types.cpp

8
libsolidity/AST.cpp

@ -206,7 +206,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getIn
return *m_interfaceFunctionList; return *m_interfaceFunctionList;
} }
TypePointer EnumvValue::getType(ContractDefinition const*) const TypePointer EnumValue::getType(ContractDefinition const*) const
{ {
EnumDefinition const* parentDef = dynamic_cast<EnumDefinition const*>(getScope()); EnumDefinition const* parentDef = dynamic_cast<EnumDefinition const*>(getScope());
return make_shared<EnumType>(*parentDef); return make_shared<EnumType>(*parentDef);
@ -263,8 +263,8 @@ void StructDefinition::checkRecursion() const
void EnumDefinition::checkValidityOfMembers() const void EnumDefinition::checkValidityOfMembers() const
{ {
vector<ASTPointer<EnumvValue>> members(getMembers()); vector<ASTPointer<EnumValue>> members(getMembers());
auto compareDecls = [](ASTPointer<EnumvValue> a, ASTPointer<EnumvValue> b) auto compareDecls = [](ASTPointer<EnumValue> a, ASTPointer<EnumValue> b)
{ {
return a->getName() < b->getName(); 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 EnumDefinition::getMemberValue(ASTString const& _member) const
{ {
unsigned int index = 0; unsigned int index = 0;
for (ASTPointer<EnumvValue> const& decl: m_members) for (ASTPointer<EnumValue> const& decl: m_members)
{ {
if (decl->getName() == _member) if (decl->getName() == _member)
return index; return index;

14
libsolidity/AST.h

@ -168,12 +168,12 @@ private:
/** /**
* Declaration of an Enum Value * Declaration of an Enum Value
*/ */
class EnumvValue : public Declaration class EnumValue: public Declaration
{ {
public: public:
EnumvValue(Location const& _location, EnumValue(Location const& _location,
ASTPointer<ASTString> const& _name): ASTPointer<ASTString> const& _name):
Declaration(_location, _name) {} Declaration(_location, _name) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override; virtual void accept(ASTConstVisitor& _visitor) const override;
@ -339,12 +339,12 @@ class EnumDefinition: public Declaration
public: public:
EnumDefinition(Location const& _location, EnumDefinition(Location const& _location,
ASTPointer<ASTString> const& _name, ASTPointer<ASTString> const& _name,
std::vector<ASTPointer<EnumvValue>> const& _members): std::vector<ASTPointer<EnumValue>> const& _members):
Declaration(_location, _name), m_members(_members) {} Declaration(_location, _name), m_members(_members) {}
virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const 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; virtual TypePointer getType(ContractDefinition const*) const override;
@ -356,7 +356,7 @@ public:
private: private:
std::vector<ASTPointer<EnumvValue>> m_members; std::vector<ASTPointer<EnumValue>> m_members;
}; };
/** /**

2
libsolidity/ASTForward.h

@ -41,7 +41,7 @@ class ContractDefinition;
class InheritanceSpecifier; class InheritanceSpecifier;
class StructDefinition; class StructDefinition;
class EnumDefinition; class EnumDefinition;
class EnumvValue; class EnumValue;
class ParameterList; class ParameterList;
class FunctionDefinition; class FunctionDefinition;
class VariableDeclaration; class VariableDeclaration;

4
libsolidity/ASTPrinter.cpp

@ -77,7 +77,7 @@ bool ASTPrinter::visit(EnumDefinition const& _node)
return goDeeper(); return goDeeper();
} }
bool ASTPrinter::visit(EnumvValue const& _node) bool ASTPrinter::visit(EnumValue const& _node)
{ {
writeLine("EnumValue \"" + _node.getName() + "\""); writeLine("EnumValue \"" + _node.getName() + "\"");
return goDeeper(); return goDeeper();
@ -364,7 +364,7 @@ void ASTPrinter::endVisit(EnumDefinition const&)
m_indentation--; m_indentation--;
} }
void ASTPrinter::endVisit(EnumvValue const&) void ASTPrinter::endVisit(EnumValue const&)
{ {
m_indentation--; m_indentation--;
} }

4
libsolidity/ASTPrinter.h

@ -47,7 +47,7 @@ public:
bool visit(InheritanceSpecifier const& _node) override; bool visit(InheritanceSpecifier const& _node) override;
bool visit(StructDefinition const& _node) override; bool visit(StructDefinition const& _node) override;
bool visit(EnumDefinition 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(ParameterList const& _node) override;
bool visit(FunctionDefinition const& _node) override; bool visit(FunctionDefinition const& _node) override;
bool visit(VariableDeclaration const& _node) override; bool visit(VariableDeclaration const& _node) override;
@ -88,7 +88,7 @@ public:
void endVisit(InheritanceSpecifier const&) override; void endVisit(InheritanceSpecifier const&) override;
void endVisit(StructDefinition const&) override; void endVisit(StructDefinition const&) override;
void endVisit(EnumDefinition const&) override; void endVisit(EnumDefinition const&) override;
void endVisit(EnumvValue const&) override; void endVisit(EnumValue const&) override;
void endVisit(ParameterList const&) override; void endVisit(ParameterList const&) override;
void endVisit(FunctionDefinition const&) override; void endVisit(FunctionDefinition const&) override;
void endVisit(VariableDeclaration const&) override; void endVisit(VariableDeclaration const&) override;

8
libsolidity/ASTVisitor.h

@ -48,7 +48,7 @@ public:
virtual bool visit(InheritanceSpecifier&) { return true; } virtual bool visit(InheritanceSpecifier&) { return true; }
virtual bool visit(StructDefinition&) { return true; } virtual bool visit(StructDefinition&) { return true; }
virtual bool visit(EnumDefinition&) { 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(ParameterList&) { return true; }
virtual bool visit(FunctionDefinition&) { return true; } virtual bool visit(FunctionDefinition&) { return true; }
virtual bool visit(VariableDeclaration&) { return true; } virtual bool visit(VariableDeclaration&) { return true; }
@ -91,7 +91,7 @@ public:
virtual void endVisit(InheritanceSpecifier&) { } virtual void endVisit(InheritanceSpecifier&) { }
virtual void endVisit(StructDefinition&) { } virtual void endVisit(StructDefinition&) { }
virtual void endVisit(EnumDefinition&) { } virtual void endVisit(EnumDefinition&) { }
virtual void endVisit(EnumvValue&) { } virtual void endVisit(EnumValue&) { }
virtual void endVisit(ParameterList&) { } virtual void endVisit(ParameterList&) { }
virtual void endVisit(FunctionDefinition&) { } virtual void endVisit(FunctionDefinition&) { }
virtual void endVisit(VariableDeclaration&) { } virtual void endVisit(VariableDeclaration&) { }
@ -138,7 +138,7 @@ public:
virtual bool visit(InheritanceSpecifier const&) { return true; } virtual bool visit(InheritanceSpecifier const&) { return true; }
virtual bool visit(StructDefinition const&) { return true; } virtual bool visit(StructDefinition const&) { return true; }
virtual bool visit(EnumDefinition 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(ParameterList const&) { return true; }
virtual bool visit(FunctionDefinition const&) { return true; } virtual bool visit(FunctionDefinition const&) { return true; }
virtual bool visit(VariableDeclaration const&) { return true; } virtual bool visit(VariableDeclaration const&) { return true; }
@ -181,7 +181,7 @@ public:
virtual void endVisit(InheritanceSpecifier const&) { } virtual void endVisit(InheritanceSpecifier const&) { }
virtual void endVisit(StructDefinition const&) { } virtual void endVisit(StructDefinition const&) { }
virtual void endVisit(EnumDefinition const&) { } virtual void endVisit(EnumDefinition const&) { }
virtual void endVisit(EnumvValue const&) { } virtual void endVisit(EnumValue const&) { }
virtual void endVisit(ParameterList const&) { } virtual void endVisit(ParameterList const&) { }
virtual void endVisit(FunctionDefinition const&) { } virtual void endVisit(FunctionDefinition const&) { }
virtual void endVisit(VariableDeclaration const&) { } virtual void endVisit(VariableDeclaration const&) { }

4
libsolidity/AST_accept.h

@ -121,13 +121,13 @@ void EnumDefinition::accept(ASTConstVisitor& _visitor) const
_visitor.endVisit(*this); _visitor.endVisit(*this);
} }
void EnumvValue::accept(ASTVisitor& _visitor) void EnumValue::accept(ASTVisitor& _visitor)
{ {
_visitor.visit(*this); _visitor.visit(*this);
_visitor.endVisit(*this); _visitor.endVisit(*this);
} }
void EnumvValue::accept(ASTConstVisitor& _visitor) const void EnumValue::accept(ASTConstVisitor& _visitor) const
{ {
_visitor.visit(*this); _visitor.visit(*this);
_visitor.endVisit(*this); _visitor.endVisit(*this);

6
libsolidity/Parser.cpp

@ -266,12 +266,12 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition()
return nodeFactory.createNode<StructDefinition>(name, members); return nodeFactory.createNode<StructDefinition>(name, members);
} }
ASTPointer<EnumvValue> Parser::parseEnumDeclaration() ASTPointer<EnumValue> Parser::parseEnumDeclaration()
{ {
ASTNodeFactory nodeFactory(*this); ASTNodeFactory nodeFactory(*this);
ASTPointer<ASTString> name = expectIdentifierToken(); ASTPointer<ASTString> name = expectIdentifierToken();
nodeFactory.markEndPosition(); nodeFactory.markEndPosition();
return nodeFactory.createNode<EnumvValue>(name); return nodeFactory.createNode<EnumValue>(name);
} }
ASTPointer<EnumDefinition> Parser::parseEnumDefinition() ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
@ -279,7 +279,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
ASTNodeFactory nodeFactory(*this); ASTNodeFactory nodeFactory(*this);
expectToken(Token::Enum); expectToken(Token::Enum);
ASTPointer<ASTString> name = expectIdentifierToken(); ASTPointer<ASTString> name = expectIdentifierToken();
vector<ASTPointer<EnumvValue>> members; vector<ASTPointer<EnumValue>> members;
expectToken(Token::LBrace); expectToken(Token::LBrace);
while (m_scanner->getCurrentToken() != Token::RBrace) while (m_scanner->getCurrentToken() != Token::RBrace)

2
libsolidity/Parser.h

@ -62,7 +62,7 @@ private:
ASTPointer<FunctionDefinition> parseFunctionDefinition(ASTString const* _contractName); ASTPointer<FunctionDefinition> parseFunctionDefinition(ASTString const* _contractName);
ASTPointer<StructDefinition> parseStructDefinition(); ASTPointer<StructDefinition> parseStructDefinition();
ASTPointer<EnumDefinition> parseEnumDefinition(); ASTPointer<EnumDefinition> parseEnumDefinition();
ASTPointer<EnumvValue> parseEnumDeclaration(); ASTPointer<EnumValue> parseEnumDeclaration();
ASTPointer<VariableDeclaration> parseVariableDeclaration(VarDeclParserOptions const& _options = VarDeclParserOptions()); ASTPointer<VariableDeclaration> parseVariableDeclaration(VarDeclParserOptions const& _options = VarDeclParserOptions());
ASTPointer<ModifierDefinition> parseModifierDefinition(); ASTPointer<ModifierDefinition> parseModifierDefinition();
ASTPointer<EventDefinition> parseEventDefinition(); ASTPointer<EventDefinition> parseEventDefinition();

2
libsolidity/Types.cpp

@ -952,7 +952,7 @@ MemberList const& TypeType::getMembers() const
else if (m_actualType->getCategory() == Category::Enum) else if (m_actualType->getCategory() == Category::Enum)
{ {
EnumDefinition const& enumDef = dynamic_cast<EnumType const&>(*m_actualType).getEnumDefinition(); 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))); members.insert(make_pair(enumValue->getName(), make_shared<EnumType>(enumDef)));
m_members.reset(new MemberList(members)); m_members.reset(new MemberList(members));
} }

Loading…
Cancel
Save