| 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/hashmap.h" | 10 #include "src/hashmap.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // and PreParser. | 272 // and PreParser. |
| 273 PreParserExpression* operator->() { return this; } | 273 PreParserExpression* operator->() { return this; } |
| 274 | 274 |
| 275 // More dummy implementations of things PreParser doesn't need to track: | 275 // More dummy implementations of things PreParser doesn't need to track: |
| 276 void set_index(int index) {} // For YieldExpressions | 276 void set_index(int index) {} // For YieldExpressions |
| 277 void set_should_eager_compile() {} | 277 void set_should_eager_compile() {} |
| 278 | 278 |
| 279 int position() const { return RelocInfo::kNoPosition; } | 279 int position() const { return RelocInfo::kNoPosition; } |
| 280 void set_function_token_position(int position) {} | 280 void set_function_token_position(int position) {} |
| 281 | 281 |
| 282 // Parenthesized expressions in the form `( Expression )`. | |
| 283 void set_is_parenthesized() { | |
| 284 code_ = ParenthesizedField::update(code_, true); | |
| 285 } | |
| 286 bool is_parenthesized() const { return ParenthesizedField::decode(code_); } | |
| 287 | |
| 288 private: | 282 private: |
| 289 enum Type { | 283 enum Type { |
| 290 kExpression, | 284 kExpression, |
| 291 kIdentifierExpression, | 285 kIdentifierExpression, |
| 292 kStringLiteralExpression, | 286 kStringLiteralExpression, |
| 293 kBinaryOperationExpression, | 287 kBinaryOperationExpression, |
| 294 kSpreadExpression, | 288 kSpreadExpression, |
| 295 kObjectLiteralExpression, | 289 kObjectLiteralExpression, |
| 296 kArrayLiteralExpression | 290 kArrayLiteralExpression |
| 297 }; | 291 }; |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 const PreParserFormalParameters& parameters, FunctionKind kind, | 1151 const PreParserFormalParameters& parameters, FunctionKind kind, |
| 1158 FunctionLiteral::FunctionType function_type, bool* ok) { | 1152 FunctionLiteral::FunctionType function_type, bool* ok) { |
| 1159 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1153 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
| 1160 kind, function_type, ok); | 1154 kind, function_type, ok); |
| 1161 } | 1155 } |
| 1162 | 1156 |
| 1163 } // namespace internal | 1157 } // namespace internal |
| 1164 } // namespace v8 | 1158 } // namespace v8 |
| 1165 | 1159 |
| 1166 #endif // V8_PARSING_PREPARSER_H | 1160 #endif // V8_PARSING_PREPARSER_H |
| OLD | NEW |