OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 } | 2535 } |
2536 bool is_await() const { return suspend_type() == SuspendFlags::kAwait; } | 2536 bool is_await() const { return suspend_type() == SuspendFlags::kAwait; } |
2537 bool is_async_generator() const { | 2537 bool is_async_generator() const { |
2538 return generator_type() == SuspendFlags::kAsyncGenerator; | 2538 return generator_type() == SuspendFlags::kAsyncGenerator; |
2539 } | 2539 } |
2540 inline bool IsNonInitialAsyncGeneratorYield() const { | 2540 inline bool IsNonInitialAsyncGeneratorYield() const { |
2541 // Return true if is_async_generator() && !is_await() && yield_id() > 0 | 2541 // Return true if is_async_generator() && !is_await() && yield_id() > 0 |
2542 return suspend_id() > 0 && (flags() & SuspendFlags::kAsyncGeneratorAwait) == | 2542 return suspend_id() > 0 && (flags() & SuspendFlags::kAsyncGeneratorAwait) == |
2543 SuspendFlags::kAsyncGenerator; | 2543 SuspendFlags::kAsyncGenerator; |
2544 } | 2544 } |
| 2545 inline bool IsNonInitialGeneratorYield() const { |
| 2546 // Return true if is_generator() && !is_await() && yield_id() > 0 |
| 2547 return suspend_id() > 0 && (flags() == SuspendFlags::kGeneratorYield); |
| 2548 } |
2545 | 2549 |
2546 void set_generator_object(Expression* e) { generator_object_ = e; } | 2550 void set_generator_object(Expression* e) { generator_object_ = e; } |
2547 void set_expression(Expression* e) { expression_ = e; } | 2551 void set_expression(Expression* e) { expression_ = e; } |
2548 void set_suspend_id(int id) { suspend_id_ = id; } | 2552 void set_suspend_id(int id) { suspend_id_ = id; } |
2549 void set_suspend_type(SuspendFlags type) { | 2553 void set_suspend_type(SuspendFlags type) { |
2550 DCHECK_EQ(0, static_cast<int>(type & ~SuspendFlags::kSuspendTypeMask)); | 2554 DCHECK_EQ(0, static_cast<int>(type & ~SuspendFlags::kSuspendTypeMask)); |
2551 bit_field_ = FlagsField::update(bit_field_, type); | 2555 bit_field_ = FlagsField::update(bit_field_, type); |
2552 } | 2556 } |
2553 | 2557 |
2554 private: | 2558 private: |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3711 : NULL; \ | 3715 : NULL; \ |
3712 } | 3716 } |
3713 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3717 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3714 #undef DECLARE_NODE_FUNCTIONS | 3718 #undef DECLARE_NODE_FUNCTIONS |
3715 | 3719 |
3716 | 3720 |
3717 } // namespace internal | 3721 } // namespace internal |
3718 } // namespace v8 | 3722 } // namespace v8 |
3719 | 3723 |
3720 #endif // V8_AST_AST_H_ | 3724 #endif // V8_AST_AST_H_ |
OLD | NEW |