| 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 // This AST Node is used to represent a dynamic import call -- |
| 2926 // import(argument). |
| 2927 class ImportCallExpression final : public Expression { |
| 2928 public: |
| 2929 Expression* argument() const { return argument_; } |
| 2930 void set_argument(Expression* argument) { argument_ = argument; } |
| 2931 |
| 2932 private: |
| 2933 friend class AstNodeFactory; |
| 2934 |
| 2935 ImportCallExpression(Expression* argument, int pos) |
| 2936 : Expression(pos, kImportCallExpression), argument_(argument) {} |
| 2937 |
| 2938 Expression* argument_; |
| 2939 }; |
| 2924 | 2940 |
| 2925 // This class is produced when parsing the () in arrow functions without any | 2941 // This class is produced when parsing the () in arrow functions without any |
| 2926 // arguments and is not actually a valid expression. | 2942 // arguments and is not actually a valid expression. |
| 2927 class EmptyParentheses final : public Expression { | 2943 class EmptyParentheses final : public Expression { |
| 2928 private: | 2944 private: |
| 2929 friend class AstNodeFactory; | 2945 friend class AstNodeFactory; |
| 2930 | 2946 |
| 2931 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} | 2947 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} |
| 2932 }; | 2948 }; |
| 2933 | 2949 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3562 | 3578 |
| 3563 EmptyParentheses* NewEmptyParentheses(int pos) { | 3579 EmptyParentheses* NewEmptyParentheses(int pos) { |
| 3564 return new (zone_) EmptyParentheses(pos); | 3580 return new (zone_) EmptyParentheses(pos); |
| 3565 } | 3581 } |
| 3566 | 3582 |
| 3567 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, | 3583 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, |
| 3568 int pos) { | 3584 int pos) { |
| 3569 return new (zone_) GetIterator(iterable, hint, pos); | 3585 return new (zone_) GetIterator(iterable, hint, pos); |
| 3570 } | 3586 } |
| 3571 | 3587 |
| 3588 ImportCallExpression* NewImportCallExpression(Expression* args, int pos) { |
| 3589 return new (zone_) ImportCallExpression(args, pos); |
| 3590 } |
| 3591 |
| 3572 Zone* zone() const { return zone_; } | 3592 Zone* zone() const { return zone_; } |
| 3573 void set_zone(Zone* zone) { zone_ = zone; } | 3593 void set_zone(Zone* zone) { zone_ = zone; } |
| 3574 | 3594 |
| 3575 // Handles use of temporary zones when parsing inner function bodies. | 3595 // Handles use of temporary zones when parsing inner function bodies. |
| 3576 class BodyScope { | 3596 class BodyScope { |
| 3577 public: | 3597 public: |
| 3578 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) | 3598 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) |
| 3579 : factory_(factory), prev_zone_(factory->zone_) { | 3599 : factory_(factory), prev_zone_(factory->zone_) { |
| 3580 if (use_temp_zone) { | 3600 if (use_temp_zone) { |
| 3581 factory->zone_ = temp_zone; | 3601 factory->zone_ = temp_zone; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 : NULL; \ | 3657 : NULL; \ |
| 3638 } | 3658 } |
| 3639 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3659 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3640 #undef DECLARE_NODE_FUNCTIONS | 3660 #undef DECLARE_NODE_FUNCTIONS |
| 3641 | 3661 |
| 3642 | 3662 |
| 3643 } // namespace internal | 3663 } // namespace internal |
| 3644 } // namespace v8 | 3664 } // namespace v8 |
| 3645 | 3665 |
| 3646 #endif // V8_AST_AST_H_ | 3666 #endif // V8_AST_AST_H_ |
| OLD | NEW |