Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 10ae7de458d1653e36a7ab688dd15b9b68e297f4..e74cd461c978abf7d3c58b1b9747070c91090a2c 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -1982,6 +1982,18 @@ class Yield: public Expression { |
Kind yield_kind() const { return yield_kind_; } |
virtual int position() const { return pos_; } |
+ // Delegating yield surrounds the "yield" in a "try/catch". This index |
+ // locates the catch handler in the handler table, and is equivalent to |
+ // TryCatchStatement::index(). |
+ int index() const { |
+ ASSERT(yield_kind() == DELEGATING); |
+ return index_; |
+ } |
+ void set_index(int index) { |
+ ASSERT(yield_kind() == DELEGATING); |
+ index_ = index; |
+ } |
+ |
protected: |
Yield(Isolate* isolate, |
Expression* generator_object, |
@@ -1992,12 +2004,14 @@ class Yield: public Expression { |
generator_object_(generator_object), |
expression_(expression), |
yield_kind_(yield_kind), |
+ index_(-1), |
pos_(pos) { } |
private: |
Expression* generator_object_; |
Expression* expression_; |
Kind yield_kind_; |
+ int index_; |
int pos_; |
}; |