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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // Generate AST node that throws a TypeError with the given | 454 // Generate AST node that throws a TypeError with the given |
455 // type. Both arguments must be non-null (in the handle sense). | 455 // type. Both arguments must be non-null (in the handle sense). |
456 Expression* NewThrowTypeError(MessageTemplate::Template message, | 456 Expression* NewThrowTypeError(MessageTemplate::Template message, |
457 const AstRawString* arg, int pos); | 457 const AstRawString* arg, int pos); |
458 | 458 |
459 // Generic AST generator for throwing errors from compiled code. | 459 // Generic AST generator for throwing errors from compiled code. |
460 Expression* NewThrowError(Runtime::FunctionId function_id, | 460 Expression* NewThrowError(Runtime::FunctionId function_id, |
461 MessageTemplate::Template message, | 461 MessageTemplate::Template message, |
462 const AstRawString* arg, int pos); | 462 const AstRawString* arg, int pos); |
463 | 463 |
| 464 Statement* FinalizeForOfStatement(ForOfStatement* loop, int pos); |
| 465 |
464 // Reporting errors. | 466 // Reporting errors. |
465 void ReportMessageAt(Scanner::Location source_location, | 467 void ReportMessageAt(Scanner::Location source_location, |
466 MessageTemplate::Template message, | 468 MessageTemplate::Template message, |
467 const char* arg = NULL, | 469 const char* arg = NULL, |
468 ParseErrorType error_type = kSyntaxError); | 470 ParseErrorType error_type = kSyntaxError); |
469 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, | 471 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, |
470 ParseErrorType error_type = kSyntaxError); | 472 ParseErrorType error_type = kSyntaxError); |
471 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg, | 473 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg, |
472 ParseErrorType error_type = kSyntaxError); | 474 ParseErrorType error_type = kSyntaxError); |
473 void ReportMessageAt(Scanner::Location source_location, | 475 void ReportMessageAt(Scanner::Location source_location, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 V8_INLINE ObjectLiteralProperty* RewriteNonPatternObjectLiteralProperty( | 657 V8_INLINE ObjectLiteralProperty* RewriteNonPatternObjectLiteralProperty( |
656 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, | 658 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, |
657 bool* ok); | 659 bool* ok); |
658 | 660 |
659 Expression* RewriteYieldStar( | 661 Expression* RewriteYieldStar( |
660 Expression* generator, Expression* expression, int pos); | 662 Expression* generator, Expression* expression, int pos); |
661 | 663 |
662 private: | 664 private: |
663 Parser* parser_; | 665 Parser* parser_; |
664 | 666 |
665 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, | 667 void BuildIteratorClose( |
666 Maybe<Variable*> input, Maybe<Variable*> output); | 668 ZoneList<Statement*>* statements, Variable* iterator, |
| 669 Expression* input, Variable* output); |
| 670 void BuildIteratorCloseForCompletion( |
| 671 ZoneList<Statement*>* statements, Variable* iterator, |
| 672 Variable* body_threw); |
667 }; | 673 }; |
668 | 674 |
669 | 675 |
670 class Parser : public ParserBase<ParserTraits> { | 676 class Parser : public ParserBase<ParserTraits> { |
671 public: | 677 public: |
672 explicit Parser(ParseInfo* info); | 678 explicit Parser(ParseInfo* info); |
673 ~Parser() { | 679 ~Parser() { |
674 delete reusable_preparser_; | 680 delete reusable_preparser_; |
675 reusable_preparser_ = NULL; | 681 reusable_preparser_ = NULL; |
676 delete cached_parse_data_; | 682 delete cached_parse_data_; |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 | 1226 |
1221 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1227 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1222 return parser_->ParseDoExpression(ok); | 1228 return parser_->ParseDoExpression(ok); |
1223 } | 1229 } |
1224 | 1230 |
1225 | 1231 |
1226 } // namespace internal | 1232 } // namespace internal |
1227 } // namespace v8 | 1233 } // namespace v8 |
1228 | 1234 |
1229 #endif // V8_PARSING_PARSER_H_ | 1235 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |