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_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 Loading... | |
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 Terminating() { | |
rossberg
2015/04/14 20:19:49
...and then we can just rename this to Jump as wel
conradw
2015/04/15 11:40:03
Done.
| |
1108 return PreParserStatement(kTerminatingStatement); | |
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 Loading... | |
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 IsStrongSwitchTerminatingStatement() { | |
1147 return code_ == kTerminatingStatement; | |
1148 } | |
1149 | |
1142 private: | 1150 private: |
1143 enum Type { | 1151 enum Type { |
1144 kUnknownStatement, | 1152 kUnknownStatement, |
1153 kTerminatingStatement, | |
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 Loading... | |
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 |
OLD | NEW |