| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1169 |
| 1170 | 1170 |
| 1171 // Delegates to another statement, which may be overwritten. | 1171 // Delegates to another statement, which may be overwritten. |
| 1172 // This was introduced to implement ES2015 Annex B3.3 for conditionally making | 1172 // This was introduced to implement ES2015 Annex B3.3 for conditionally making |
| 1173 // sloppy-mode block-scoped functions have a var binding, which is changed | 1173 // sloppy-mode block-scoped functions have a var binding, which is changed |
| 1174 // from one statement to another during parsing. | 1174 // from one statement to another during parsing. |
| 1175 class SloppyBlockFunctionStatement final : public Statement { | 1175 class SloppyBlockFunctionStatement final : public Statement { |
| 1176 public: | 1176 public: |
| 1177 Statement* statement() const { return statement_; } | 1177 Statement* statement() const { return statement_; } |
| 1178 void set_statement(Statement* statement) { statement_ = statement; } | 1178 void set_statement(Statement* statement) { statement_ = statement; } |
| 1179 VariableProxy* from() const { return from_; } | |
| 1180 void set_from(VariableProxy* from) { from_ = from; } | |
| 1181 VariableProxy* to() const { return to_; } | |
| 1182 void set_to(VariableProxy* to) { to_ = to; } | |
| 1183 Scope* scope() const { return scope_; } | 1179 Scope* scope() const { return scope_; } |
| 1184 SloppyBlockFunctionStatement* next() { return next_; } | 1180 SloppyBlockFunctionStatement* next() { return next_; } |
| 1185 void set_next(SloppyBlockFunctionStatement* next) { next_ = next; } | 1181 void set_next(SloppyBlockFunctionStatement* next) { next_ = next; } |
| 1186 | 1182 |
| 1187 private: | 1183 private: |
| 1188 friend class AstNodeFactory; | 1184 friend class AstNodeFactory; |
| 1189 | 1185 |
| 1190 SloppyBlockFunctionStatement(Statement* statement, Scope* scope) | 1186 SloppyBlockFunctionStatement(Statement* statement, Scope* scope) |
| 1191 : Statement(kNoSourcePosition, kSloppyBlockFunctionStatement), | 1187 : Statement(kNoSourcePosition, kSloppyBlockFunctionStatement), |
| 1192 statement_(statement), | 1188 statement_(statement), |
| 1193 from_(nullptr), | |
| 1194 to_(nullptr), | |
| 1195 scope_(scope), | 1189 scope_(scope), |
| 1196 next_(nullptr) {} | 1190 next_(nullptr) {} |
| 1197 | 1191 |
| 1198 Statement* statement_; | 1192 Statement* statement_; |
| 1199 VariableProxy* from_; | |
| 1200 VariableProxy* to_; | |
| 1201 Scope* const scope_; | 1193 Scope* const scope_; |
| 1202 SloppyBlockFunctionStatement* next_; | 1194 SloppyBlockFunctionStatement* next_; |
| 1203 }; | 1195 }; |
| 1204 | 1196 |
| 1205 | 1197 |
| 1206 class Literal final : public Expression { | 1198 class Literal final : public Expression { |
| 1207 public: | 1199 public: |
| 1208 // Returns true if literal represents a property name (i.e. cannot be parsed | 1200 // Returns true if literal represents a property name (i.e. cannot be parsed |
| 1209 // as array indices). | 1201 // as array indices). |
| 1210 bool IsPropertyName() const { return value_->IsPropertyName(); } | 1202 bool IsPropertyName() const { return value_->IsPropertyName(); } |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3517 : NULL; \ | 3509 : NULL; \ |
| 3518 } | 3510 } |
| 3519 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3511 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3520 #undef DECLARE_NODE_FUNCTIONS | 3512 #undef DECLARE_NODE_FUNCTIONS |
| 3521 | 3513 |
| 3522 | 3514 |
| 3523 } // namespace internal | 3515 } // namespace internal |
| 3524 } // namespace v8 | 3516 } // namespace v8 |
| 3525 | 3517 |
| 3526 #endif // V8_AST_AST_H_ | 3518 #endif // V8_AST_AST_H_ |
| OLD | NEW |