Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: src/ast/ast.h

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 DCHECK(this_var->is_this()); 2925 DCHECK(this_var->is_this());
2925 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); 2926 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target"));
2926 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); 2927 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function"));
2927 } 2928 }
2928 2929
2929 VariableProxy* this_var_; 2930 VariableProxy* this_var_;
2930 VariableProxy* new_target_var_; 2931 VariableProxy* new_target_var_;
2931 VariableProxy* this_function_var_; 2932 VariableProxy* this_function_var_;
2932 }; 2933 };
2933 2934
2935 // This AST Node is used to represent a dynamic import call --
2936 // import(argument).
2937 class ImportCallExpression final : public Expression {
2938 public:
2939 Expression* argument() const { return argument_; }
2940 void set_argument(Expression* argument) { argument_ = argument; }
2941
2942 private:
2943 friend class AstNodeFactory;
2944
2945 ImportCallExpression(Expression* argument, int pos)
2946 : Expression(pos, kImportCallExpression), argument_(argument) {}
2947
2948 Expression* argument_;
2949 };
2934 2950
2935 // This class is produced when parsing the () in arrow functions without any 2951 // This class is produced when parsing the () in arrow functions without any
2936 // arguments and is not actually a valid expression. 2952 // arguments and is not actually a valid expression.
2937 class EmptyParentheses final : public Expression { 2953 class EmptyParentheses final : public Expression {
2938 private: 2954 private:
2939 friend class AstNodeFactory; 2955 friend class AstNodeFactory;
2940 2956
2941 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} 2957 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {}
2942 }; 2958 };
2943 2959
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 3588
3573 EmptyParentheses* NewEmptyParentheses(int pos) { 3589 EmptyParentheses* NewEmptyParentheses(int pos) {
3574 return new (zone_) EmptyParentheses(pos); 3590 return new (zone_) EmptyParentheses(pos);
3575 } 3591 }
3576 3592
3577 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, 3593 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint,
3578 int pos) { 3594 int pos) {
3579 return new (zone_) GetIterator(iterable, hint, pos); 3595 return new (zone_) GetIterator(iterable, hint, pos);
3580 } 3596 }
3581 3597
3598 ImportCallExpression* NewImportCallExpression(Expression* args, int pos) {
3599 return new (zone_) ImportCallExpression(args, pos);
3600 }
3601
3582 Zone* zone() const { return zone_; } 3602 Zone* zone() const { return zone_; }
3583 void set_zone(Zone* zone) { zone_ = zone; } 3603 void set_zone(Zone* zone) { zone_ = zone; }
3584 3604
3585 // Handles use of temporary zones when parsing inner function bodies. 3605 // Handles use of temporary zones when parsing inner function bodies.
3586 class BodyScope { 3606 class BodyScope {
3587 public: 3607 public:
3588 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) 3608 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone)
3589 : factory_(factory), prev_zone_(factory->zone_) { 3609 : factory_(factory), prev_zone_(factory->zone_) {
3590 if (use_temp_zone) { 3610 if (use_temp_zone) {
3591 factory->zone_ = temp_zone; 3611 factory->zone_ = temp_zone;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 : NULL; \ 3667 : NULL; \
3648 } 3668 }
3649 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3669 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3650 #undef DECLARE_NODE_FUNCTIONS 3670 #undef DECLARE_NODE_FUNCTIONS
3651 3671
3652 3672
3653 } // namespace internal 3673 } // namespace internal
3654 } // namespace v8 3674 } // namespace v8
3655 3675
3656 #endif // V8_AST_AST_H_ 3676 #endif // V8_AST_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698