Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index b7331388fd9744954519b8ea8c91fdfa7667682b..2b0b009ab30104c0c6468296d74e3e50b212205a 100644 |
| --- a/src/ast.h |
| +++ b/src/ast.h |
| @@ -1964,27 +1964,41 @@ class Yield: public Expression { |
| public: |
| DECLARE_NODE_TYPE(Yield) |
| + enum Kind { |
| + // The initial yield that returns the unboxed generator object. |
| + INITIAL, |
|
Michael Starzinger
2013/04/17 13:43:48
nit: Can we compact this enum a bit (e.g. by movin
|
| + |
| + // A normal yield: { value: VALUE, done: false } |
| + SUSPEND, |
| + |
| + // A yield*. |
| + DELEGATING, |
| + |
| + // A return: { value: VALUE, done: true } |
| + FINAL |
| + }; |
| + |
| Expression* generator_object() const { return generator_object_; } |
| Expression* expression() const { return expression_; } |
| - bool is_delegating_yield() const { return is_delegating_yield_; } |
| + Kind kind() const { return kind_; } |
|
Michael Starzinger
2013/04/17 13:43:48
nit: There are so many "kinds" in V8 already, can
|
| virtual int position() const { return pos_; } |
| protected: |
| Yield(Isolate* isolate, |
| Expression* generator_object, |
| Expression* expression, |
| - bool is_delegating_yield, |
| + Kind kind, |
| int pos) |
| : Expression(isolate), |
| generator_object_(generator_object), |
| expression_(expression), |
| - is_delegating_yield_(is_delegating_yield), |
| + kind_(kind), |
| pos_(pos) { } |
| private: |
| Expression* generator_object_; |
| Expression* expression_; |
| - bool is_delegating_yield_; |
| + Kind kind_; |
| int pos_; |
| }; |
| @@ -2966,10 +2980,10 @@ class AstNodeFactory BASE_EMBEDDED { |
| Yield* NewYield(Expression *generator_object, |
| Expression* expression, |
| - bool is_delegating_yield, |
| + Yield::Kind kind, |
| int pos) { |
| Yield* yield = new(zone_) Yield( |
| - isolate_, generator_object, expression, is_delegating_yield, pos); |
| + isolate_, generator_object, expression, kind, pos); |
| VISIT_AND_RETURN(Yield, yield) |
| } |