| 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/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/ast/ast-types.h" | 9 #include "src/ast/ast-types.h" |
| 10 #include "src/ast/ast-value-factory.h" | 10 #include "src/ast/ast-value-factory.h" |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 | 1175 |
| 1176 | 1176 |
| 1177 // Delegates to another statement, which may be overwritten. | 1177 // Delegates to another statement, which may be overwritten. |
| 1178 // This was introduced to implement ES2015 Annex B3.3 for conditionally making | 1178 // This was introduced to implement ES2015 Annex B3.3 for conditionally making |
| 1179 // sloppy-mode block-scoped functions have a var binding, which is changed | 1179 // sloppy-mode block-scoped functions have a var binding, which is changed |
| 1180 // from one statement to another during parsing. | 1180 // from one statement to another during parsing. |
| 1181 class SloppyBlockFunctionStatement final : public Statement { | 1181 class SloppyBlockFunctionStatement final : public Statement { |
| 1182 public: | 1182 public: |
| 1183 Statement* statement() const { return statement_; } | 1183 Statement* statement() const { return statement_; } |
| 1184 void set_statement(Statement* statement) { statement_ = statement; } | 1184 void set_statement(Statement* statement) { statement_ = statement; } |
| 1185 Scope* scope() const { return scope_; } | |
| 1186 SloppyBlockFunctionStatement* next() { return next_; } | |
| 1187 void set_next(SloppyBlockFunctionStatement* next) { next_ = next; } | |
| 1188 | 1185 |
| 1189 private: | 1186 private: |
| 1190 friend class AstNodeFactory; | 1187 friend class AstNodeFactory; |
| 1191 | 1188 |
| 1192 SloppyBlockFunctionStatement(Statement* statement, Scope* scope) | 1189 explicit SloppyBlockFunctionStatement(Statement* statement) |
| 1193 : Statement(kNoSourcePosition, kSloppyBlockFunctionStatement), | 1190 : Statement(kNoSourcePosition, kSloppyBlockFunctionStatement), |
| 1194 statement_(statement), | 1191 statement_(statement) {} |
| 1195 scope_(scope), | |
| 1196 next_(nullptr) {} | |
| 1197 | 1192 |
| 1198 Statement* statement_; | 1193 Statement* statement_; |
| 1199 Scope* const scope_; | |
| 1200 SloppyBlockFunctionStatement* next_; | |
| 1201 }; | 1194 }; |
| 1202 | 1195 |
| 1203 | 1196 |
| 1204 class Literal final : public Expression { | 1197 class Literal final : public Expression { |
| 1205 public: | 1198 public: |
| 1206 // Returns true if literal represents a property name (i.e. cannot be parsed | 1199 // Returns true if literal represents a property name (i.e. cannot be parsed |
| 1207 // as array indices). | 1200 // as array indices). |
| 1208 bool IsPropertyName() const { return value_->IsPropertyName(); } | 1201 bool IsPropertyName() const { return value_->IsPropertyName(); } |
| 1209 | 1202 |
| 1210 Handle<String> AsPropertyName() { | 1203 Handle<String> AsPropertyName() { |
| (...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 } | 3247 } |
| 3255 | 3248 |
| 3256 DebuggerStatement* NewDebuggerStatement(int pos) { | 3249 DebuggerStatement* NewDebuggerStatement(int pos) { |
| 3257 return new (zone_) DebuggerStatement(pos); | 3250 return new (zone_) DebuggerStatement(pos); |
| 3258 } | 3251 } |
| 3259 | 3252 |
| 3260 EmptyStatement* NewEmptyStatement(int pos) { | 3253 EmptyStatement* NewEmptyStatement(int pos) { |
| 3261 return new (zone_) EmptyStatement(pos); | 3254 return new (zone_) EmptyStatement(pos); |
| 3262 } | 3255 } |
| 3263 | 3256 |
| 3264 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement(Scope* scope) { | 3257 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement() { |
| 3265 return new (zone_) SloppyBlockFunctionStatement( | 3258 return new (zone_) |
| 3266 NewEmptyStatement(kNoSourcePosition), scope); | 3259 SloppyBlockFunctionStatement(NewEmptyStatement(kNoSourcePosition)); |
| 3267 } | 3260 } |
| 3268 | 3261 |
| 3269 CaseClause* NewCaseClause( | 3262 CaseClause* NewCaseClause( |
| 3270 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3263 Expression* label, ZoneList<Statement*>* statements, int pos) { |
| 3271 return new (zone_) CaseClause(label, statements, pos); | 3264 return new (zone_) CaseClause(label, statements, pos); |
| 3272 } | 3265 } |
| 3273 | 3266 |
| 3274 Literal* NewStringLiteral(const AstRawString* string, int pos) { | 3267 Literal* NewStringLiteral(const AstRawString* string, int pos) { |
| 3275 return new (zone_) Literal(ast_value_factory_->NewString(string), pos); | 3268 return new (zone_) Literal(ast_value_factory_->NewString(string), pos); |
| 3276 } | 3269 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3617 : NULL; \ | 3610 : NULL; \ |
| 3618 } | 3611 } |
| 3619 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3612 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3620 #undef DECLARE_NODE_FUNCTIONS | 3613 #undef DECLARE_NODE_FUNCTIONS |
| 3621 | 3614 |
| 3622 | 3615 |
| 3623 } // namespace internal | 3616 } // namespace internal |
| 3624 } // namespace v8 | 3617 } // namespace v8 |
| 3625 | 3618 |
| 3626 #endif // V8_AST_AST_H_ | 3619 #endif // V8_AST_AST_H_ |
| OLD | NEW |