diff -r 27f12e2fc369 -r 46fc53b8fd2f jitcraft/AST.h --- a/jitcraft/AST.h Mon Jun 25 21:20:01 2012 -0700 +++ b/jitcraft/AST.h Tue Jun 26 00:35:15 2012 -0700 @@ -38,7 +38,8 @@ _(FunctionStatement) \ _(CallExpression) \ _(IfStatement) \ - _(IndexExpression) + _(IndexExpression) \ + _(EnumStatement) // Forward declarations. #define _(name) class name; @@ -501,6 +502,48 @@ } }; +class EnumStatement : public Statement +{ + Name *name_; + + public: + struct Entry { + NamedConstant *name; + Expression *expr; + + Entry(NamedConstant *name, Expression *expr) + : name(name), + expr(expr) + { + } + }; + + typedef std::vector EntryList; + + public: + EnumStatement(Name *name, EntryList *entries) + : name_(name), + entries_(entries) + { + } + + Kind kind() const { + return kEnumStatement; + } + Name *name() const { + return name_; + } + EntryList *entries() const { + return entries_; + } + void accept(AstVisitor *visitor) { + visitor->visit(this); + } + + private: + EntryList *entries_; +}; + class Scope; typedef std::vector NameProxyList;