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

Side by Side Diff: src/preparser.h

Issue 1084983002: [strong] Implement static restrictions on switch statement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 3 Created 5 years, 8 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/parser.cc ('k') | src/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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 typedef PreParserList<PreParserExpression> PreParserExpressionList; 1097 typedef PreParserList<PreParserExpression> PreParserExpressionList;
1098 typedef PreParserList<PreParserIdentifier> PreParserFormalParameterList; 1098 typedef PreParserList<PreParserIdentifier> PreParserFormalParameterList;
1099 1099
1100 1100
1101 class PreParserStatement { 1101 class PreParserStatement {
1102 public: 1102 public:
1103 static PreParserStatement Default() { 1103 static PreParserStatement Default() {
1104 return PreParserStatement(kUnknownStatement); 1104 return PreParserStatement(kUnknownStatement);
1105 } 1105 }
1106 1106
1107 static PreParserStatement Jump() {
1108 return PreParserStatement(kJumpStatement);
1109 }
1110
1107 static PreParserStatement FunctionDeclaration() { 1111 static PreParserStatement FunctionDeclaration() {
1108 return PreParserStatement(kFunctionDeclaration); 1112 return PreParserStatement(kFunctionDeclaration);
1109 } 1113 }
1110 1114
1111 // Creates expression statement from expression. 1115 // Creates expression statement from expression.
1112 // Preserves being an unparenthesized string literal, possibly 1116 // Preserves being an unparenthesized string literal, possibly
1113 // "use strict". 1117 // "use strict".
1114 static PreParserStatement ExpressionStatement( 1118 static PreParserStatement ExpressionStatement(
1115 PreParserExpression expression) { 1119 PreParserExpression expression) {
1116 if (expression.IsUseStrictLiteral()) { 1120 if (expression.IsUseStrictLiteral()) {
(...skipping 15 matching lines...) Expand all
1132 bool IsUseStrictLiteral() { 1136 bool IsUseStrictLiteral() {
1133 return code_ == kUseStrictExpressionStatement; 1137 return code_ == kUseStrictExpressionStatement;
1134 } 1138 }
1135 1139
1136 bool IsUseStrongLiteral() { return code_ == kUseStrongExpressionStatement; } 1140 bool IsUseStrongLiteral() { return code_ == kUseStrongExpressionStatement; }
1137 1141
1138 bool IsFunctionDeclaration() { 1142 bool IsFunctionDeclaration() {
1139 return code_ == kFunctionDeclaration; 1143 return code_ == kFunctionDeclaration;
1140 } 1144 }
1141 1145
1146 bool IsJumpStatement() {
1147 return code_ == kJumpStatement;
1148 }
1149
1142 private: 1150 private:
1143 enum Type { 1151 enum Type {
1144 kUnknownStatement, 1152 kUnknownStatement,
1153 kJumpStatement,
1145 kStringLiteralExpressionStatement, 1154 kStringLiteralExpressionStatement,
1146 kUseStrictExpressionStatement, 1155 kUseStrictExpressionStatement,
1147 kUseStrongExpressionStatement, 1156 kUseStrongExpressionStatement,
1148 kFunctionDeclaration 1157 kFunctionDeclaration
1149 }; 1158 };
1150 1159
1151 explicit PreParserStatement(Type code) : code_(code) {} 1160 explicit PreParserStatement(Type code) : code_(code) {}
1152 Type code_; 1161 Type code_;
1153 }; 1162 };
1154 1163
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 *ok = false; 3484 *ok = false;
3476 return; 3485 return;
3477 } 3486 }
3478 has_seen_constructor_ = true; 3487 has_seen_constructor_ = true;
3479 return; 3488 return;
3480 } 3489 }
3481 } 3490 }
3482 } } // v8::internal 3491 } } // v8::internal
3483 3492
3484 #endif // V8_PREPARSER_H 3493 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698