| 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_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
| 6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 typedef PreParserFactory Factory; | 617 typedef PreParserFactory Factory; |
| 618 }; | 618 }; |
| 619 | 619 |
| 620 // TODO(nikolaos): The traits methods should not need to call methods | 620 // TODO(nikolaos): The traits methods should not need to call methods |
| 621 // of the implementation object. | 621 // of the implementation object. |
| 622 PreParser* delegate() { return reinterpret_cast<PreParser*>(this); } | 622 PreParser* delegate() { return reinterpret_cast<PreParser*>(this); } |
| 623 const PreParser* delegate() const { | 623 const PreParser* delegate() const { |
| 624 return reinterpret_cast<const PreParser*>(this); | 624 return reinterpret_cast<const PreParser*>(this); |
| 625 } | 625 } |
| 626 | 626 |
| 627 PreParserExpression BuildUnaryExpression(PreParserExpression expression, | |
| 628 Token::Value op, int pos, | |
| 629 PreParserFactory* factory) { | |
| 630 return PreParserExpression::Default(); | |
| 631 } | |
| 632 | |
| 633 PreParserExpression BuildIteratorResult(PreParserExpression value, | |
| 634 bool done) { | |
| 635 return PreParserExpression::Default(); | |
| 636 } | |
| 637 | |
| 638 PreParserExpression NewThrowReferenceError(MessageTemplate::Template message, | |
| 639 int pos) { | |
| 640 return PreParserExpression::Default(); | |
| 641 } | |
| 642 | |
| 643 PreParserExpression NewThrowSyntaxError(MessageTemplate::Template message, | |
| 644 PreParserIdentifier arg, int pos) { | |
| 645 return PreParserExpression::Default(); | |
| 646 } | |
| 647 | |
| 648 PreParserExpression NewThrowTypeError(MessageTemplate::Template message, | |
| 649 PreParserIdentifier arg, int pos) { | |
| 650 return PreParserExpression::Default(); | |
| 651 } | |
| 652 | |
| 653 // Reporting errors. | |
| 654 void ReportMessageAt(Scanner::Location source_location, | |
| 655 MessageTemplate::Template message, | |
| 656 const char* arg = NULL, | |
| 657 ParseErrorType error_type = kSyntaxError); | |
| 658 void ReportMessageAt(Scanner::Location source_location, | |
| 659 MessageTemplate::Template message, | |
| 660 const AstRawString* arg, | |
| 661 ParseErrorType error_type = kSyntaxError); | |
| 662 | |
| 663 // A dummy function, just useful as an argument to CHECK_OK_CUSTOM. | 627 // A dummy function, just useful as an argument to CHECK_OK_CUSTOM. |
| 664 static void Void() {} | 628 static void Void() {} |
| 665 | 629 |
| 666 // "null" return type creators. | |
| 667 static PreParserIdentifier EmptyIdentifier() { | |
| 668 return PreParserIdentifier::Default(); | |
| 669 } | |
| 670 static PreParserExpression EmptyExpression() { | |
| 671 return PreParserExpression::Default(); | |
| 672 } | |
| 673 static PreParserExpression EmptyLiteral() { | |
| 674 return PreParserExpression::Default(); | |
| 675 } | |
| 676 static PreParserExpression EmptyObjectLiteralProperty() { | |
| 677 return PreParserExpression::Default(); | |
| 678 } | |
| 679 static PreParserExpression EmptyFunctionLiteral() { | |
| 680 return PreParserExpression::Default(); | |
| 681 } | |
| 682 | |
| 683 static PreParserExpressionList NullExpressionList() { | |
| 684 return PreParserExpressionList(); | |
| 685 } | |
| 686 PreParserIdentifier EmptyIdentifierString() const { | |
| 687 return PreParserIdentifier::Default(); | |
| 688 } | |
| 689 | |
| 690 // Odd-ball literal creators. | |
| 691 PreParserExpression GetLiteralTheHole(int position, | |
| 692 PreParserFactory* factory) const { | |
| 693 return PreParserExpression::Default(); | |
| 694 } | |
| 695 | |
| 696 // Producing data during the recursive descent. | 630 // Producing data during the recursive descent. |
| 697 PreParserIdentifier GetSymbol(Scanner* scanner) const; | 631 PreParserIdentifier GetSymbol(Scanner* scanner) const; |
| 698 | 632 |
| 699 PreParserIdentifier GetNextSymbol(Scanner* scanner) const { | 633 PreParserIdentifier GetNextSymbol(Scanner* scanner) const { |
| 700 return PreParserIdentifier::Default(); | 634 return PreParserIdentifier::Default(); |
| 701 } | 635 } |
| 702 | 636 |
| 703 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) const { | 637 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) const { |
| 704 return PreParserIdentifier::Default(); | 638 return PreParserIdentifier::Default(); |
| 705 } | 639 } |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 return expression; | 1068 return expression; |
| 1135 } | 1069 } |
| 1136 | 1070 |
| 1137 V8_INLINE bool ShortcutNumericLiteralBinaryExpression(PreParserExpression* x, | 1071 V8_INLINE bool ShortcutNumericLiteralBinaryExpression(PreParserExpression* x, |
| 1138 PreParserExpression y, | 1072 PreParserExpression y, |
| 1139 Token::Value op, | 1073 Token::Value op, |
| 1140 int pos) { | 1074 int pos) { |
| 1141 return false; | 1075 return false; |
| 1142 } | 1076 } |
| 1143 | 1077 |
| 1078 V8_INLINE PreParserExpression BuildUnaryExpression( |
| 1079 PreParserExpression expression, Token::Value op, int pos) { |
| 1080 return PreParserExpression::Default(); |
| 1081 } |
| 1082 |
| 1083 V8_INLINE PreParserExpression BuildIteratorResult(PreParserExpression value, |
| 1084 bool done) { |
| 1085 return PreParserExpression::Default(); |
| 1086 } |
| 1087 |
| 1088 V8_INLINE PreParserExpression |
| 1089 NewThrowReferenceError(MessageTemplate::Template message, int pos) { |
| 1090 return PreParserExpression::Default(); |
| 1091 } |
| 1092 |
| 1093 V8_INLINE PreParserExpression NewThrowSyntaxError( |
| 1094 MessageTemplate::Template message, PreParserIdentifier arg, int pos) { |
| 1095 return PreParserExpression::Default(); |
| 1096 } |
| 1097 |
| 1098 V8_INLINE PreParserExpression NewThrowTypeError( |
| 1099 MessageTemplate::Template message, PreParserIdentifier arg, int pos) { |
| 1100 return PreParserExpression::Default(); |
| 1101 } |
| 1102 |
| 1103 // Reporting errors. |
| 1104 V8_INLINE void ReportMessageAt(Scanner::Location source_location, |
| 1105 MessageTemplate::Template message, |
| 1106 const char* arg = NULL, |
| 1107 ParseErrorType error_type = kSyntaxError) { |
| 1108 log_->LogMessage(source_location.beg_pos, source_location.end_pos, message, |
| 1109 arg, error_type); |
| 1110 } |
| 1111 |
| 1112 V8_INLINE void ReportMessageAt(Scanner::Location source_location, |
| 1113 MessageTemplate::Template message, |
| 1114 const AstRawString* arg, |
| 1115 ParseErrorType error_type = kSyntaxError) { |
| 1116 UNREACHABLE(); |
| 1117 } |
| 1118 |
| 1119 // "null" return type creators. |
| 1120 V8_INLINE static PreParserIdentifier EmptyIdentifier() { |
| 1121 return PreParserIdentifier::Default(); |
| 1122 } |
| 1123 V8_INLINE static PreParserExpression EmptyExpression() { |
| 1124 return PreParserExpression::Default(); |
| 1125 } |
| 1126 V8_INLINE static PreParserExpression EmptyLiteral() { |
| 1127 return PreParserExpression::Default(); |
| 1128 } |
| 1129 V8_INLINE static PreParserExpression EmptyObjectLiteralProperty() { |
| 1130 return PreParserExpression::Default(); |
| 1131 } |
| 1132 V8_INLINE static PreParserExpression EmptyFunctionLiteral() { |
| 1133 return PreParserExpression::Default(); |
| 1134 } |
| 1135 |
| 1136 V8_INLINE static PreParserExpressionList NullExpressionList() { |
| 1137 return PreParserExpressionList(); |
| 1138 } |
| 1139 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { |
| 1140 return PreParserIdentifier::Default(); |
| 1141 } |
| 1142 |
| 1143 // Odd-ball literal creators. |
| 1144 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { |
| 1145 return PreParserExpression::Default(); |
| 1146 } |
| 1147 |
| 1144 // Preparser's private field members. | 1148 // Preparser's private field members. |
| 1145 | 1149 |
| 1146 int* use_counts_; | 1150 int* use_counts_; |
| 1147 }; | 1151 }; |
| 1148 | 1152 |
| 1149 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals( | 1153 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals( |
| 1150 int count) { | 1154 int count) { |
| 1151 for (int i = 0; i < count; ++i) { | 1155 for (int i = 0; i < count; ++i) { |
| 1152 delegate()->function_state_->NextMaterializedLiteralIndex(); | 1156 delegate()->function_state_->NextMaterializedLiteralIndex(); |
| 1153 } | 1157 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 function_state_->NextMaterializedLiteralIndex(); | 1220 function_state_->NextMaterializedLiteralIndex(); |
| 1217 function_state_->NextMaterializedLiteralIndex(); | 1221 function_state_->NextMaterializedLiteralIndex(); |
| 1218 } | 1222 } |
| 1219 return EmptyExpression(); | 1223 return EmptyExpression(); |
| 1220 } | 1224 } |
| 1221 | 1225 |
| 1222 } // namespace internal | 1226 } // namespace internal |
| 1223 } // namespace v8 | 1227 } // namespace v8 |
| 1224 | 1228 |
| 1225 #endif // V8_PARSING_PREPARSER_H | 1229 #endif // V8_PARSING_PREPARSER_H |
| OLD | NEW |