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 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2701 RequiresClassFieldInit::update(bit_field_, requires_class_field_init); | 2701 RequiresClassFieldInit::update(bit_field_, requires_class_field_init); |
2702 } | 2702 } |
2703 bool is_class_field_initializer() { | 2703 bool is_class_field_initializer() { |
2704 return IsClassFieldInitializer::decode(bit_field_); | 2704 return IsClassFieldInitializer::decode(bit_field_); |
2705 } | 2705 } |
2706 void set_is_class_field_initializer(bool is_class_field_initializer) { | 2706 void set_is_class_field_initializer(bool is_class_field_initializer) { |
2707 bit_field_ = | 2707 bit_field_ = |
2708 IsClassFieldInitializer::update(bit_field_, is_class_field_initializer); | 2708 IsClassFieldInitializer::update(bit_field_, is_class_field_initializer); |
2709 } | 2709 } |
2710 | 2710 |
2711 bool HasSingleReturnBody() { | |
2712 return body_->length() == 1 && | |
Yang
2016/11/08 12:23:33
I think adding another flag to FunctionLiteral mak
kozy
2016/11/08 16:28:45
Done.
| |
2713 body_->at(0)->node_type() == AstNode::kReturnStatement; | |
2714 } | |
2715 | |
2711 private: | 2716 private: |
2712 friend class AstNodeFactory; | 2717 friend class AstNodeFactory; |
2713 | 2718 |
2714 FunctionLiteral(Zone* zone, const AstString* name, | 2719 FunctionLiteral(Zone* zone, const AstString* name, |
2715 AstValueFactory* ast_value_factory, DeclarationScope* scope, | 2720 AstValueFactory* ast_value_factory, DeclarationScope* scope, |
2716 ZoneList<Statement*>* body, int materialized_literal_count, | 2721 ZoneList<Statement*>* body, int materialized_literal_count, |
2717 int expected_property_count, int parameter_count, | 2722 int expected_property_count, int parameter_count, |
2718 int function_length, FunctionType function_type, | 2723 int function_length, FunctionType function_type, |
2719 ParameterFlag has_duplicate_parameters, | 2724 ParameterFlag has_duplicate_parameters, |
2720 EagerCompileHint eager_compile_hint, int position, | 2725 EagerCompileHint eager_compile_hint, int position, |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3597 : NULL; \ | 3602 : NULL; \ |
3598 } | 3603 } |
3599 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3604 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3600 #undef DECLARE_NODE_FUNCTIONS | 3605 #undef DECLARE_NODE_FUNCTIONS |
3601 | 3606 |
3602 | 3607 |
3603 } // namespace internal | 3608 } // namespace internal |
3604 } // namespace v8 | 3609 } // namespace v8 |
3605 | 3610 |
3606 #endif // V8_AST_AST_H_ | 3611 #endif // V8_AST_AST_H_ |
OLD | NEW |