jitcraft/AST.h
changeset 22 765ab1b672a3
parent 21 af5d8e985502
child 23 8a31742781c1
     1.1 --- a/jitcraft/AST.h	Sun Jul 01 14:52:57 2012 -0700
     1.2 +++ b/jitcraft/AST.h	Sun Jul 01 16:36:39 2012 -0700
     1.3 @@ -381,16 +381,16 @@
     1.4  class ForStatement : public Statement
     1.5  {
     1.6      Scope *scope_;
     1.7 -    VariableDeclaration *declaration_;
     1.8 +    Statement *initialization_;
     1.9      Expression *condition_;
    1.10      Statement *update_;
    1.11      Statement *body_;
    1.12  
    1.13    public:
    1.14 -    ForStatement(Scope *scope, VariableDeclaration *declaration,
    1.15 +    ForStatement(Scope *scope, Statement *initialization,
    1.16                   Expression *condition, Statement *update, Statement *body)
    1.17        : scope_(scope),
    1.18 -        declaration_(declaration),
    1.19 +        initialization_(initialization),
    1.20          condition_(condition),
    1.21          update_(update),
    1.22          body_(body)
    1.23 @@ -400,8 +400,8 @@
    1.24      Kind kind() const {
    1.25          return kForStatement;
    1.26      }
    1.27 -    VariableDeclaration *declaration() const {
    1.28 -        return declaration_;
    1.29 +    Statement *initialization() const {
    1.30 +        return initialization_;
    1.31      }
    1.32      Scope *scope() const {
    1.33          return scope_;
    1.34 @@ -504,12 +504,14 @@
    1.35  
    1.36  class Assignment : public Expression
    1.37  {
    1.38 +    TokenKind token_;
    1.39      Expression *lvalue_;
    1.40      Expression *expression_;
    1.41  
    1.42    public:
    1.43 -    Assignment(Expression *left, Expression *right)
    1.44 -      : lvalue_(left),
    1.45 +    Assignment(TokenKind token, Expression *left, Expression *right)
    1.46 +      : token_(token),
    1.47 +        lvalue_(left),
    1.48          expression_(right)
    1.49      {
    1.50      }
    1.51 @@ -517,6 +519,9 @@
    1.52      Kind kind() const {
    1.53          return kAssignment;
    1.54      }
    1.55 +    TokenKind token() const {
    1.56 +        return token_;
    1.57 +    }
    1.58      Expression *lvalue() const {
    1.59          return lvalue_;
    1.60      }