| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 // must have extra bit. | 2137 // must have extra bit. |
| 2138 SmallMapList receiver_types_; | 2138 SmallMapList receiver_types_; |
| 2139 }; | 2139 }; |
| 2140 | 2140 |
| 2141 | 2141 |
| 2142 class Yield: public Expression { | 2142 class Yield: public Expression { |
| 2143 public: | 2143 public: |
| 2144 DECLARE_NODE_TYPE(Yield) | 2144 DECLARE_NODE_TYPE(Yield) |
| 2145 | 2145 |
| 2146 enum Kind { | 2146 enum Kind { |
| 2147 INITIAL, // The initial yield that returns the unboxed generator object. | 2147 kInitial, // The initial yield that returns the unboxed generator object |
| 2148 SUSPEND, // A normal yield: { value: EXPRESSION, done: false } | 2148 kSuspend, // A normal yield: { value: EXPRESSION, done: false } |
| 2149 DELEGATING, // A yield*. | 2149 kDelegating, // A yield*. |
| 2150 FINAL // A return: { value: EXPRESSION, done: true } | 2150 kFinal // A return: { value: EXPRESSION, done: true } |
| 2151 }; | 2151 }; |
| 2152 | 2152 |
| 2153 Expression* generator_object() const { return generator_object_; } | 2153 Expression* generator_object() const { return generator_object_; } |
| 2154 Expression* expression() const { return expression_; } | 2154 Expression* expression() const { return expression_; } |
| 2155 Kind yield_kind() const { return yield_kind_; } | 2155 Kind yield_kind() const { return yield_kind_; } |
| 2156 virtual int position() const { return pos_; } | 2156 virtual int position() const { return pos_; } |
| 2157 | 2157 |
| 2158 // Delegating yield surrounds the "yield" in a "try/catch". This index | 2158 // Delegating yield surrounds the "yield" in a "try/catch". This index |
| 2159 // locates the catch handler in the handler table, and is equivalent to | 2159 // locates the catch handler in the handler table, and is equivalent to |
| 2160 // TryCatchStatement::index(). | 2160 // TryCatchStatement::index(). |
| 2161 int index() const { | 2161 int index() const { |
| 2162 ASSERT(yield_kind() == DELEGATING); | 2162 ASSERT(yield_kind() == kDelegating); |
| 2163 return index_; | 2163 return index_; |
| 2164 } | 2164 } |
| 2165 void set_index(int index) { | 2165 void set_index(int index) { |
| 2166 ASSERT(yield_kind() == DELEGATING); | 2166 ASSERT(yield_kind() == kDelegating); |
| 2167 index_ = index; | 2167 index_ = index; |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 protected: | 2170 protected: |
| 2171 Yield(Isolate* isolate, | 2171 Yield(Isolate* isolate, |
| 2172 Expression* generator_object, | 2172 Expression* generator_object, |
| 2173 Expression* expression, | 2173 Expression* expression, |
| 2174 Kind yield_kind, | 2174 Kind yield_kind, |
| 2175 int pos) | 2175 int pos) |
| 2176 : Expression(isolate), | 2176 : Expression(isolate), |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3225 private: | 3225 private: |
| 3226 Isolate* isolate_; | 3226 Isolate* isolate_; |
| 3227 Zone* zone_; | 3227 Zone* zone_; |
| 3228 Visitor visitor_; | 3228 Visitor visitor_; |
| 3229 }; | 3229 }; |
| 3230 | 3230 |
| 3231 | 3231 |
| 3232 } } // namespace v8::internal | 3232 } } // namespace v8::internal |
| 3233 | 3233 |
| 3234 #endif // V8_AST_H_ | 3234 #endif // V8_AST_H_ |
| OLD | NEW |