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 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 } | 2534 } |
2535 bool is_await() const { return suspend_type() == SuspendFlags::kAwait; } | 2535 bool is_await() const { return suspend_type() == SuspendFlags::kAwait; } |
2536 bool is_async_generator() const { | 2536 bool is_async_generator() const { |
2537 return generator_type() == SuspendFlags::kAsyncGenerator; | 2537 return generator_type() == SuspendFlags::kAsyncGenerator; |
2538 } | 2538 } |
2539 inline bool IsNonInitialAsyncGeneratorYield() const { | 2539 inline bool IsNonInitialAsyncGeneratorYield() const { |
2540 // Return true if is_async_generator() && !is_await() && yield_id() > 0 | 2540 // Return true if is_async_generator() && !is_await() && yield_id() > 0 |
2541 return suspend_id() > 0 && (flags() & SuspendFlags::kAsyncGeneratorAwait) == | 2541 return suspend_id() > 0 && (flags() & SuspendFlags::kAsyncGeneratorAwait) == |
2542 SuspendFlags::kAsyncGenerator; | 2542 SuspendFlags::kAsyncGenerator; |
2543 } | 2543 } |
| 2544 inline bool IsNonInitialGeneratorYield() const { |
| 2545 // Return true if is_generator() && !is_await() && yield_id() > 0 |
| 2546 return suspend_id() > 0 && (flags() == SuspendFlags::kGeneratorYield); |
| 2547 } |
2544 | 2548 |
2545 void set_expression(Expression* e) { expression_ = e; } | 2549 void set_expression(Expression* e) { expression_ = e; } |
2546 void set_suspend_id(int id) { suspend_id_ = id; } | 2550 void set_suspend_id(int id) { suspend_id_ = id; } |
2547 void set_suspend_type(SuspendFlags type) { | 2551 void set_suspend_type(SuspendFlags type) { |
2548 DCHECK_EQ(0, static_cast<int>(type & ~SuspendFlags::kSuspendTypeMask)); | 2552 DCHECK_EQ(0, static_cast<int>(type & ~SuspendFlags::kSuspendTypeMask)); |
2549 bit_field_ = FlagsField::update(bit_field_, type); | 2553 bit_field_ = FlagsField::update(bit_field_, type); |
2550 } | 2554 } |
2551 | 2555 |
2552 private: | 2556 private: |
2553 friend class AstNodeFactory; | 2557 friend class AstNodeFactory; |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 : NULL; \ | 3708 : NULL; \ |
3705 } | 3709 } |
3706 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3710 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3707 #undef DECLARE_NODE_FUNCTIONS | 3711 #undef DECLARE_NODE_FUNCTIONS |
3708 | 3712 |
3709 | 3713 |
3710 } // namespace internal | 3714 } // namespace internal |
3711 } // namespace v8 | 3715 } // namespace v8 |
3712 | 3716 |
3713 #endif // V8_AST_AST_H_ | 3717 #endif // V8_AST_AST_H_ |
OLD | NEW |