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_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 642 |
643 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 643 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
644 Expression* assignment); | 644 Expression* assignment); |
645 | 645 |
646 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, | 646 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, |
647 const AstRawString* name); | 647 const AstRawString* name); |
648 | 648 |
649 void SetFunctionNameFromIdentifierRef(Expression* value, | 649 void SetFunctionNameFromIdentifierRef(Expression* value, |
650 Expression* identifier); | 650 Expression* identifier); |
651 | 651 |
| 652 // Rewrite expressions that are not used as patterns |
| 653 V8_INLINE Expression* RewriteNonPattern( |
| 654 Expression* expr, const ExpressionClassifier* classifier, bool* ok); |
| 655 V8_INLINE ZoneList<Expression*>* RewriteNonPatternArguments( |
| 656 ZoneList<Expression*>* args, const ExpressionClassifier* classifier, |
| 657 bool* ok); |
| 658 V8_INLINE ObjectLiteralProperty* RewriteNonPatternObjectLiteralProperty( |
| 659 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, |
| 660 bool* ok); |
| 661 |
652 private: | 662 private: |
653 Parser* parser_; | 663 Parser* parser_; |
654 }; | 664 }; |
655 | 665 |
656 | 666 |
657 class Parser : public ParserBase<ParserTraits> { | 667 class Parser : public ParserBase<ParserTraits> { |
658 public: | 668 public: |
659 explicit Parser(ParseInfo* info); | 669 explicit Parser(ParseInfo* info); |
660 ~Parser() { | 670 ~Parser() { |
661 delete reusable_preparser_; | 671 delete reusable_preparser_; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 Expression* SpreadCall(Expression* function, | 1006 Expression* SpreadCall(Expression* function, |
997 ZoneList<v8::internal::Expression*>* args, int pos); | 1007 ZoneList<v8::internal::Expression*>* args, int pos); |
998 Expression* SpreadCallNew(Expression* function, | 1008 Expression* SpreadCallNew(Expression* function, |
999 ZoneList<v8::internal::Expression*>* args, int pos); | 1009 ZoneList<v8::internal::Expression*>* args, int pos); |
1000 | 1010 |
1001 void SetLanguageMode(Scope* scope, LanguageMode mode); | 1011 void SetLanguageMode(Scope* scope, LanguageMode mode); |
1002 void RaiseLanguageMode(LanguageMode mode); | 1012 void RaiseLanguageMode(LanguageMode mode); |
1003 | 1013 |
1004 V8_INLINE void RewriteDestructuringAssignments(); | 1014 V8_INLINE void RewriteDestructuringAssignments(); |
1005 | 1015 |
| 1016 V8_INLINE Expression* RewriteNonPattern( |
| 1017 Expression* expr, const ExpressionClassifier* classifier, bool* ok); |
| 1018 V8_INLINE ZoneList<Expression*>* RewriteNonPatternArguments( |
| 1019 ZoneList<Expression*>* args, const ExpressionClassifier* classifier, |
| 1020 bool* ok); |
| 1021 V8_INLINE ObjectLiteralProperty* RewriteNonPatternObjectLiteralProperty( |
| 1022 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, |
| 1023 bool* ok); |
| 1024 |
1006 friend class InitializerRewriter; | 1025 friend class InitializerRewriter; |
1007 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 1026 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
1008 | 1027 |
1009 Scanner scanner_; | 1028 Scanner scanner_; |
1010 PreParser* reusable_preparser_; | 1029 PreParser* reusable_preparser_; |
1011 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1030 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1012 Target* target_stack_; // for break, continue statements | 1031 Target* target_stack_; // for break, continue statements |
1013 ScriptCompiler::CompileOptions compile_options_; | 1032 ScriptCompiler::CompileOptions compile_options_; |
1014 ParseData* cached_parse_data_; | 1033 ParseData* cached_parse_data_; |
1015 | 1034 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 | 1211 |
1193 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1212 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1194 return parser_->ParseDoExpression(ok); | 1213 return parser_->ParseDoExpression(ok); |
1195 } | 1214 } |
1196 | 1215 |
1197 | 1216 |
1198 } // namespace internal | 1217 } // namespace internal |
1199 } // namespace v8 | 1218 } // namespace v8 |
1200 | 1219 |
1201 #endif // V8_PARSING_PARSER_H_ | 1220 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |