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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 V(BinaryOperation) \ | 98 V(BinaryOperation) \ |
99 V(CompareOperation) \ | 99 V(CompareOperation) \ |
100 V(Spread) \ | 100 V(Spread) \ |
101 V(ThisFunction) \ | 101 V(ThisFunction) \ |
102 V(SuperPropertyReference) \ | 102 V(SuperPropertyReference) \ |
103 V(SuperCallReference) \ | 103 V(SuperCallReference) \ |
104 V(CaseClause) \ | 104 V(CaseClause) \ |
105 V(EmptyParentheses) \ | 105 V(EmptyParentheses) \ |
106 V(GetIterator) \ | 106 V(GetIterator) \ |
107 V(DoExpression) \ | 107 V(DoExpression) \ |
108 V(RewritableExpression) | 108 V(RewritableExpression) \ |
109 V(ImportCallExpression) | |
109 | 110 |
110 #define AST_NODE_LIST(V) \ | 111 #define AST_NODE_LIST(V) \ |
111 DECLARATION_NODE_LIST(V) \ | 112 DECLARATION_NODE_LIST(V) \ |
112 STATEMENT_NODE_LIST(V) \ | 113 STATEMENT_NODE_LIST(V) \ |
113 EXPRESSION_NODE_LIST(V) | 114 EXPRESSION_NODE_LIST(V) |
114 | 115 |
115 // Forward declarations | 116 // Forward declarations |
116 class AstNodeFactory; | 117 class AstNodeFactory; |
117 class Declaration; | 118 class Declaration; |
118 class Module; | 119 class Module; |
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2914 DCHECK(this_var->is_this()); | 2915 DCHECK(this_var->is_this()); |
2915 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); | 2916 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); |
2916 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); | 2917 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); |
2917 } | 2918 } |
2918 | 2919 |
2919 VariableProxy* this_var_; | 2920 VariableProxy* this_var_; |
2920 VariableProxy* new_target_var_; | 2921 VariableProxy* new_target_var_; |
2921 VariableProxy* this_function_var_; | 2922 VariableProxy* this_function_var_; |
2922 }; | 2923 }; |
2923 | 2924 |
2925 class ImportCallExpression final : public Expression { | |
adamk
2017/03/15 21:36:43
Please add a comment for this.
gsathya
2017/03/16 00:59:24
Feel free to suggest something more comprehensive.
| |
2926 public: | |
2927 Expression* arg() const { return arg_; } | |
adamk
2017/03/15 21:36:43
Please use a full word here, "argument". Same for
gsathya
2017/03/16 00:59:24
Done.
| |
2928 void set_arg(Expression* arg) { arg_ = arg; } | |
2929 | |
2930 private: | |
2931 friend class AstNodeFactory; | |
2932 | |
2933 ImportCallExpression(Expression* arg, int pos) | |
2934 : Expression(pos, kImportCallExpression), arg_(arg) {} | |
2935 | |
2936 Expression* arg_; | |
2937 }; | |
2924 | 2938 |
2925 // This class is produced when parsing the () in arrow functions without any | 2939 // This class is produced when parsing the () in arrow functions without any |
2926 // arguments and is not actually a valid expression. | 2940 // arguments and is not actually a valid expression. |
2927 class EmptyParentheses final : public Expression { | 2941 class EmptyParentheses final : public Expression { |
2928 private: | 2942 private: |
2929 friend class AstNodeFactory; | 2943 friend class AstNodeFactory; |
2930 | 2944 |
2931 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} | 2945 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} |
2932 }; | 2946 }; |
2933 | 2947 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3562 | 3576 |
3563 EmptyParentheses* NewEmptyParentheses(int pos) { | 3577 EmptyParentheses* NewEmptyParentheses(int pos) { |
3564 return new (zone_) EmptyParentheses(pos); | 3578 return new (zone_) EmptyParentheses(pos); |
3565 } | 3579 } |
3566 | 3580 |
3567 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, | 3581 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, |
3568 int pos) { | 3582 int pos) { |
3569 return new (zone_) GetIterator(iterable, hint, pos); | 3583 return new (zone_) GetIterator(iterable, hint, pos); |
3570 } | 3584 } |
3571 | 3585 |
3586 ImportCallExpression* NewImportCallExpression(Expression* args, int pos) { | |
3587 return new (zone_) ImportCallExpression(args, pos); | |
3588 } | |
3589 | |
3572 Zone* zone() const { return zone_; } | 3590 Zone* zone() const { return zone_; } |
3573 void set_zone(Zone* zone) { zone_ = zone; } | 3591 void set_zone(Zone* zone) { zone_ = zone; } |
3574 | 3592 |
3575 // Handles use of temporary zones when parsing inner function bodies. | 3593 // Handles use of temporary zones when parsing inner function bodies. |
3576 class BodyScope { | 3594 class BodyScope { |
3577 public: | 3595 public: |
3578 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) | 3596 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) |
3579 : factory_(factory), prev_zone_(factory->zone_) { | 3597 : factory_(factory), prev_zone_(factory->zone_) { |
3580 if (use_temp_zone) { | 3598 if (use_temp_zone) { |
3581 factory->zone_ = temp_zone; | 3599 factory->zone_ = temp_zone; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3637 : NULL; \ | 3655 : NULL; \ |
3638 } | 3656 } |
3639 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3657 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3640 #undef DECLARE_NODE_FUNCTIONS | 3658 #undef DECLARE_NODE_FUNCTIONS |
3641 | 3659 |
3642 | 3660 |
3643 } // namespace internal | 3661 } // namespace internal |
3644 } // namespace v8 | 3662 } // namespace v8 |
3645 | 3663 |
3646 #endif // V8_AST_AST_H_ | 3664 #endif // V8_AST_AST_H_ |
OLD | NEW |