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