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

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

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: add test + comments 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 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 DCHECK(this_var->is_this()); 2936 DCHECK(this_var->is_this());
2936 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); 2937 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target"));
2937 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); 2938 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function"));
2938 } 2939 }
2939 2940
2940 VariableProxy* this_var_; 2941 VariableProxy* this_var_;
2941 VariableProxy* new_target_var_; 2942 VariableProxy* new_target_var_;
2942 VariableProxy* this_function_var_; 2943 VariableProxy* this_function_var_;
2943 }; 2944 };
2944 2945
2946 // This AST Node is used to represent a dynamic import call --
2947 // import(argument).
2948 class ImportCallExpression final : public Expression {
2949 public:
2950 Expression* argument() const { return argument_; }
2951 void set_argument(Expression* argument) { argument_ = argument; }
2952
2953 private:
2954 friend class AstNodeFactory;
2955
2956 ImportCallExpression(Expression* argument, int pos)
2957 : Expression(pos, kImportCallExpression), argument_(argument) {}
2958
2959 Expression* argument_;
2960 };
2945 2961
2946 // This class is produced when parsing the () in arrow functions without any 2962 // This class is produced when parsing the () in arrow functions without any
2947 // arguments and is not actually a valid expression. 2963 // arguments and is not actually a valid expression.
2948 class EmptyParentheses final : public Expression { 2964 class EmptyParentheses final : public Expression {
2949 private: 2965 private:
2950 friend class AstNodeFactory; 2966 friend class AstNodeFactory;
2951 2967
2952 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} 2968 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {}
2953 }; 2969 };
2954 2970
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
3583 3599
3584 EmptyParentheses* NewEmptyParentheses(int pos) { 3600 EmptyParentheses* NewEmptyParentheses(int pos) {
3585 return new (zone_) EmptyParentheses(pos); 3601 return new (zone_) EmptyParentheses(pos);
3586 } 3602 }
3587 3603
3588 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint, 3604 GetIterator* NewGetIterator(Expression* iterable, IteratorType hint,
3589 int pos) { 3605 int pos) {
3590 return new (zone_) GetIterator(iterable, hint, pos); 3606 return new (zone_) GetIterator(iterable, hint, pos);
3591 } 3607 }
3592 3608
3609 ImportCallExpression* NewImportCallExpression(Expression* args, int pos) {
3610 return new (zone_) ImportCallExpression(args, pos);
3611 }
3612
3593 Zone* zone() const { return zone_; } 3613 Zone* zone() const { return zone_; }
3594 void set_zone(Zone* zone) { zone_ = zone; } 3614 void set_zone(Zone* zone) { zone_ = zone; }
3595 3615
3596 // Handles use of temporary zones when parsing inner function bodies. 3616 // Handles use of temporary zones when parsing inner function bodies.
3597 class BodyScope { 3617 class BodyScope {
3598 public: 3618 public:
3599 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) 3619 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone)
3600 : factory_(factory), prev_zone_(factory->zone_) { 3620 : factory_(factory), prev_zone_(factory->zone_) {
3601 if (use_temp_zone) { 3621 if (use_temp_zone) {
3602 factory->zone_ = temp_zone; 3622 factory->zone_ = temp_zone;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3658 : NULL; \ 3678 : NULL; \
3659 } 3679 }
3660 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3680 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3661 #undef DECLARE_NODE_FUNCTIONS 3681 #undef DECLARE_NODE_FUNCTIONS
3662 3682
3663 3683
3664 } // namespace internal 3684 } // namespace internal
3665 } // namespace v8 3685 } // namespace v8
3666 3686
3667 #endif // V8_AST_AST_H_ 3687 #endif // V8_AST_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698