jitcraft/AST.h
changeset 23 8a31742781c1
parent 22 765ab1b672a3
child 25 23e8b3d8e4e6
     1.1 --- a/jitcraft/AST.h	Sun Jul 01 16:36:39 2012 -0700
     1.2 +++ b/jitcraft/AST.h	Sun Jul 01 18:21:15 2012 -0700
     1.3 @@ -44,7 +44,8 @@
     1.4      _(EnumStatement)            \
     1.5      _(WhileStatement)           \
     1.6      _(BreakStatement)           \
     1.7 -    _(ContinueStatement)
     1.8 +    _(ContinueStatement)        \
     1.9 +    _(IncDecExpression)
    1.10  
    1.11  // Forward declarations.
    1.12  #define _(name) class name;
    1.13 @@ -694,6 +695,37 @@
    1.14      EntryList *entries_;
    1.15  };
    1.16  
    1.17 +class IncDecExpression : public Expression
    1.18 +{
    1.19 +    TokenKind token_;
    1.20 +    Expression *expression_;
    1.21 +    bool postfix_;
    1.22 +
    1.23 +  public:
    1.24 +    IncDecExpression(TokenKind token, Expression *expression, bool postfix)
    1.25 +      : token_(token),
    1.26 +        expression_(expression),
    1.27 +        postfix_(postfix)
    1.28 +    {
    1.29 +    }
    1.30 +
    1.31 +    Kind kind() const {
    1.32 +        return kIncDecExpression;
    1.33 +    }
    1.34 +    TokenKind token() const {
    1.35 +        return token_;
    1.36 +    }
    1.37 +    Expression *expression() const {
    1.38 +        return expression_;
    1.39 +    }
    1.40 +    bool postfix() const {
    1.41 +        return postfix_;
    1.42 +    }
    1.43 +    void accept(AstVisitor *visitor) {
    1.44 +        visitor->visit(this);
    1.45 +    }
    1.46 +};
    1.47 +
    1.48  class Scope;
    1.49  
    1.50  typedef std::vector<NameProxy *> NameProxyList;