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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 explicit PreParserIdentifier(Type type) : type_(type) {} | 111 explicit PreParserIdentifier(Type type) : type_(type) {} |
112 Type type_; | 112 Type type_; |
113 | 113 |
114 friend class PreParserExpression; | 114 friend class PreParserExpression; |
115 }; | 115 }; |
116 | 116 |
117 | 117 |
118 class PreParserExpression { | 118 class PreParserExpression { |
119 public: | 119 public: |
| 120 PreParserExpression() : code_(TypeField::encode(kExpression)) {} |
| 121 |
120 static PreParserExpression Default() { | 122 static PreParserExpression Default() { |
121 return PreParserExpression(TypeField::encode(kExpression)); | 123 return PreParserExpression(); |
122 } | 124 } |
123 | 125 |
124 static PreParserExpression Spread(PreParserExpression expression) { | 126 static PreParserExpression Spread(PreParserExpression expression) { |
125 return PreParserExpression(TypeField::encode(kSpreadExpression)); | 127 return PreParserExpression(TypeField::encode(kSpreadExpression)); |
126 } | 128 } |
127 | 129 |
128 static PreParserExpression FromIdentifier(PreParserIdentifier id) { | 130 static PreParserExpression FromIdentifier(PreParserIdentifier id) { |
129 return PreParserExpression(TypeField::encode(kIdentifierExpression) | | 131 return PreParserExpression(TypeField::encode(kIdentifierExpression) | |
130 IdentifierTypeField::encode(id.type_)); | 132 IdentifierTypeField::encode(id.type_)); |
131 } | 133 } |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 const PreParserFormalParameters& parameters, FunctionKind kind, | 1266 const PreParserFormalParameters& parameters, FunctionKind kind, |
1265 FunctionLiteral::FunctionType function_type, bool* ok) { | 1267 FunctionLiteral::FunctionType function_type, bool* ok) { |
1266 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1268 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1267 kind, function_type, ok); | 1269 kind, function_type, ok); |
1268 } | 1270 } |
1269 | 1271 |
1270 } // namespace internal | 1272 } // namespace internal |
1271 } // namespace v8 | 1273 } // namespace v8 |
1272 | 1274 |
1273 #endif // V8_PARSING_PREPARSER_H | 1275 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |