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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( | 840 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( |
841 ZoneList<v8::internal::Expression*>* list); | 841 ZoneList<v8::internal::Expression*>* list); |
842 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} | 842 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} |
843 V8_INLINE Expression* SpreadCall(Expression* function, | 843 V8_INLINE Expression* SpreadCall(Expression* function, |
844 ZoneList<v8::internal::Expression*>* args, | 844 ZoneList<v8::internal::Expression*>* args, |
845 int pos); | 845 int pos); |
846 V8_INLINE Expression* SpreadCallNew(Expression* function, | 846 V8_INLINE Expression* SpreadCallNew(Expression* function, |
847 ZoneList<v8::internal::Expression*>* args, | 847 ZoneList<v8::internal::Expression*>* args, |
848 int pos); | 848 int pos); |
849 | 849 |
| 850 inline Expression* RewriteDestructuringAssignment(Expression* expr); |
| 851 |
850 private: | 852 private: |
851 Parser* parser_; | 853 Parser* parser_; |
852 }; | 854 }; |
853 | 855 |
854 | 856 |
855 class Parser : public ParserBase<ParserTraits> { | 857 class Parser : public ParserBase<ParserTraits> { |
856 public: | 858 public: |
857 explicit Parser(ParseInfo* info); | 859 explicit Parser(ParseInfo* info); |
858 ~Parser() { | 860 ~Parser() { |
859 delete reusable_preparser_; | 861 delete reusable_preparser_; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 // Initialize the components of a for-in / for-of statement. | 1069 // Initialize the components of a for-in / for-of statement. |
1068 void InitializeForEachStatement(ForEachStatement* stmt, | 1070 void InitializeForEachStatement(ForEachStatement* stmt, |
1069 Expression* each, | 1071 Expression* each, |
1070 Expression* subject, | 1072 Expression* subject, |
1071 Statement* body); | 1073 Statement* body); |
1072 Statement* DesugarLexicalBindingsInForStatement( | 1074 Statement* DesugarLexicalBindingsInForStatement( |
1073 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 1075 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
1074 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 1076 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
1075 Statement* body, bool* ok); | 1077 Statement* body, bool* ok); |
1076 | 1078 |
| 1079 Expression* DesugarDestructuringAssignment(Expression* expr); |
| 1080 |
1077 FunctionLiteral* ParseFunctionLiteral( | 1081 FunctionLiteral* ParseFunctionLiteral( |
1078 const AstRawString* name, Scanner::Location function_name_location, | 1082 const AstRawString* name, Scanner::Location function_name_location, |
1079 bool name_is_strict_reserved, FunctionKind kind, | 1083 bool name_is_strict_reserved, FunctionKind kind, |
1080 int function_token_position, FunctionLiteral::FunctionType type, | 1084 int function_token_position, FunctionLiteral::FunctionType type, |
1081 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1085 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
1082 | 1086 |
1083 | 1087 |
1084 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1088 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
1085 Scanner::Location class_name_location, | 1089 Scanner::Location class_name_location, |
1086 bool name_is_strict_reserved, int pos, | 1090 bool name_is_strict_reserved, int pos, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 ZoneList<v8::internal::Expression*>* args, | 1275 ZoneList<v8::internal::Expression*>* args, |
1272 int pos) { | 1276 int pos) { |
1273 return parser_->SpreadCall(function, args, pos); | 1277 return parser_->SpreadCall(function, args, pos); |
1274 } | 1278 } |
1275 | 1279 |
1276 | 1280 |
1277 Expression* ParserTraits::SpreadCallNew( | 1281 Expression* ParserTraits::SpreadCallNew( |
1278 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1282 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1279 return parser_->SpreadCallNew(function, args, pos); | 1283 return parser_->SpreadCallNew(function, args, pos); |
1280 } | 1284 } |
| 1285 |
| 1286 |
| 1287 inline Expression* ParserTraits::RewriteDestructuringAssignment( |
| 1288 Expression* expr) { |
| 1289 return parser_->DesugarDestructuringAssignment(expr); |
| 1290 } |
1281 } } // namespace v8::internal | 1291 } } // namespace v8::internal |
1282 | 1292 |
1283 #endif // V8_PARSER_H_ | 1293 #endif // V8_PARSER_H_ |
OLD | NEW |