Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/parsing/preparser.h

Issue 2274113002: [parser] Clean up (pre)parser traits, part 4 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // 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.
628 static void Void() {} 628 static void Void() {}
629 629
630 // Producing data during the recursive descent.
631 PreParserIdentifier GetSymbol(Scanner* scanner) const;
632
633 PreParserIdentifier GetNextSymbol(Scanner* scanner) const {
634 return PreParserIdentifier::Default();
635 }
636
637 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) const {
638 return PreParserIdentifier::Default();
639 }
640
641 PreParserExpression ThisExpression(int pos = kNoSourcePosition) {
642 return PreParserExpression::This();
643 }
644
645 PreParserExpression NewSuperPropertyReference(PreParserFactory* factory,
646 int pos) {
647 return PreParserExpression::Default();
648 }
649
650 PreParserExpression NewSuperCallReference(PreParserFactory* factory,
651 int pos) {
652 return PreParserExpression::SuperCallReference();
653 }
654
655 PreParserExpression NewTargetExpression(int pos) {
656 return PreParserExpression::Default();
657 }
658
659 PreParserExpression FunctionSentExpression(PreParserFactory* factory,
660 int pos) const {
661 return PreParserExpression::Default();
662 }
663
664 PreParserExpression ExpressionFromLiteral(Token::Value token, int pos,
665 Scanner* scanner,
666 PreParserFactory* factory) const {
667 return PreParserExpression::Default();
668 }
669
670 PreParserExpression ExpressionFromIdentifier(PreParserIdentifier name,
671 int start_position,
672 int end_position,
673 InferName = InferName::kYes) {
674 return PreParserExpression::FromIdentifier(name);
675 }
676
677 PreParserExpression ExpressionFromString(int pos, Scanner* scanner,
678 PreParserFactory* factory) const;
679
680 PreParserExpression GetIterator(PreParserExpression iterable,
681 PreParserFactory* factory, int pos) {
682 return PreParserExpression::Default();
683 }
684
685 PreParserExpressionList NewExpressionList(int size, Zone* zone) const {
686 return PreParserExpressionList();
687 }
688
689 PreParserExpressionList NewPropertyList(int size, Zone* zone) const {
690 return PreParserExpressionList();
691 }
692
693 PreParserStatementList NewStatementList(int size, Zone* zone) const {
694 return PreParserStatementList();
695 }
696
697 void AddParameterInitializationBlock( 630 void AddParameterInitializationBlock(
698 const PreParserFormalParameters& parameters, PreParserStatementList body, 631 const PreParserFormalParameters& parameters, PreParserStatementList body,
699 bool is_async, bool* ok) {} 632 bool is_async, bool* ok) {}
700 633
701 void AddFormalParameter(PreParserFormalParameters* parameters, 634 void AddFormalParameter(PreParserFormalParameters* parameters,
702 PreParserExpression pattern, 635 PreParserExpression pattern,
703 PreParserExpression initializer, 636 PreParserExpression initializer,
704 int initializer_end_position, bool is_rest) { 637 int initializer_end_position, bool is_rest) {
705 ++parameters->arity; 638 ++parameters->arity;
706 } 639 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1071 }
1139 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { 1072 V8_INLINE PreParserIdentifier EmptyIdentifierString() const {
1140 return PreParserIdentifier::Default(); 1073 return PreParserIdentifier::Default();
1141 } 1074 }
1142 1075
1143 // Odd-ball literal creators. 1076 // Odd-ball literal creators.
1144 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { 1077 V8_INLINE PreParserExpression GetLiteralTheHole(int position) {
1145 return PreParserExpression::Default(); 1078 return PreParserExpression::Default();
1146 } 1079 }
1147 1080
1081 // Producing data during the recursive descent.
1082 PreParserIdentifier GetSymbol() const;
1083
1084 V8_INLINE PreParserIdentifier GetNextSymbol() const {
1085 return PreParserIdentifier::Default();
1086 }
1087
1088 V8_INLINE PreParserIdentifier GetNumberAsSymbol() const {
1089 return PreParserIdentifier::Default();
1090 }
1091
1092 V8_INLINE PreParserExpression ThisExpression(int pos = kNoSourcePosition) {
1093 return PreParserExpression::This();
1094 }
1095
1096 V8_INLINE PreParserExpression NewSuperPropertyReference(int pos) {
1097 return PreParserExpression::Default();
1098 }
1099
1100 V8_INLINE PreParserExpression NewSuperCallReference(int pos) {
1101 return PreParserExpression::SuperCallReference();
1102 }
1103
1104 V8_INLINE PreParserExpression NewTargetExpression(int pos) {
1105 return PreParserExpression::Default();
1106 }
1107
1108 V8_INLINE PreParserExpression FunctionSentExpression(int pos) {
1109 return PreParserExpression::Default();
1110 }
1111
1112 V8_INLINE PreParserExpression ExpressionFromLiteral(Token::Value token,
1113 int pos) {
1114 return PreParserExpression::Default();
1115 }
1116
1117 V8_INLINE PreParserExpression ExpressionFromIdentifier(
1118 PreParserIdentifier name, int start_position, int end_position,
1119 InferName infer = InferName::kYes) {
1120 return PreParserExpression::FromIdentifier(name);
1121 }
1122
1123 V8_INLINE PreParserExpression ExpressionFromString(int pos) {
1124 if (scanner()->UnescapedLiteralMatches("use strict", 10)) {
1125 return PreParserExpression::UseStrictStringLiteral();
1126 }
1127 return PreParserExpression::StringLiteral();
1128 }
1129
1130 V8_INLINE PreParserExpressionList NewExpressionList(int size) const {
1131 return PreParserExpressionList();
1132 }
1133
1134 V8_INLINE PreParserExpressionList NewPropertyList(int size) const {
1135 return PreParserExpressionList();
1136 }
1137
1138 V8_INLINE PreParserStatementList NewStatementList(int size) const {
1139 return PreParserStatementList();
1140 }
1141
1148 // Preparser's private field members. 1142 // Preparser's private field members.
1149 1143
1150 int* use_counts_; 1144 int* use_counts_;
1151 }; 1145 };
1152 1146
1153 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals( 1147 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals(
1154 int count) { 1148 int count) {
1155 for (int i = 0; i < count; ++i) { 1149 for (int i = 0; i < count; ++i) {
1156 delegate()->function_state_->NextMaterializedLiteralIndex(); 1150 delegate()->function_state_->NextMaterializedLiteralIndex();
1157 } 1151 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 function_state_->NextMaterializedLiteralIndex(); 1214 function_state_->NextMaterializedLiteralIndex();
1221 function_state_->NextMaterializedLiteralIndex(); 1215 function_state_->NextMaterializedLiteralIndex();
1222 } 1216 }
1223 return EmptyExpression(); 1217 return EmptyExpression();
1224 } 1218 }
1225 1219
1226 } // namespace internal 1220 } // namespace internal
1227 } // namespace v8 1221 } // namespace v8
1228 1222
1229 #endif // V8_PARSING_PREPARSER_H 1223 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698