| 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_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
| 6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 struct TypeSystem { | 355 struct TypeSystem { |
| 356 typedef v8::internal::typesystem::Type* Type; | 356 typedef v8::internal::typesystem::Type* Type; |
| 357 typedef ZoneList<v8::internal::typesystem::Type*>* TypeList; | 357 typedef ZoneList<v8::internal::typesystem::Type*>* TypeList; |
| 358 typedef v8::internal::typesystem::TypeParameter* TypeParameter; | 358 typedef v8::internal::typesystem::TypeParameter* TypeParameter; |
| 359 typedef ZoneList<v8::internal::typesystem::TypeParameter*>* | 359 typedef ZoneList<v8::internal::typesystem::TypeParameter*>* |
| 360 TypeParameters; | 360 TypeParameters; |
| 361 typedef v8::internal::typesystem::FormalParameter* FormalParameter; | 361 typedef v8::internal::typesystem::FormalParameter* FormalParameter; |
| 362 typedef ZoneList<v8::internal::typesystem::FormalParameter*>* | 362 typedef ZoneList<v8::internal::typesystem::FormalParameter*>* |
| 363 FormalParameters; | 363 FormalParameters; |
| 364 typedef v8::internal::typesystem::TypeMember* TypeMember; |
| 365 typedef ZoneList<v8::internal::typesystem::TypeMember*>* TypeMembers; |
| 364 }; | 366 }; |
| 365 | 367 |
| 366 // For constructing objects returned by the traversing functions. | 368 // For constructing objects returned by the traversing functions. |
| 367 typedef AstNodeFactory Factory; | 369 typedef AstNodeFactory Factory; |
| 368 }; | 370 }; |
| 369 | 371 |
| 370 explicit ParserTraits(Parser* parser) : parser_(parser) {} | 372 explicit ParserTraits(Parser* parser) : parser_(parser) {} |
| 371 | 373 |
| 372 // Helper functions for recursive descent. | 374 // Helper functions for recursive descent. |
| 373 bool IsEval(const AstRawString* identifier) const; | 375 bool IsEval(const AstRawString* identifier) const; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 static ZoneList<typesystem::Type*>* NullTypeList() { return nullptr; } | 505 static ZoneList<typesystem::Type*>* NullTypeList() { return nullptr; } |
| 504 V8_INLINE ZoneList<typesystem::Type*>* EmptyTypeList() const; | 506 V8_INLINE ZoneList<typesystem::Type*>* EmptyTypeList() const; |
| 505 static ZoneList<typesystem::TypeParameter*>* NullTypeParameters() { | 507 static ZoneList<typesystem::TypeParameter*>* NullTypeParameters() { |
| 506 return nullptr; | 508 return nullptr; |
| 507 } | 509 } |
| 508 static bool IsNullTypeParameters( | 510 static bool IsNullTypeParameters( |
| 509 ZoneList<typesystem::TypeParameter*>* typ_pars) { | 511 ZoneList<typesystem::TypeParameter*>* typ_pars) { |
| 510 return typ_pars == nullptr; | 512 return typ_pars == nullptr; |
| 511 } | 513 } |
| 512 V8_INLINE ZoneList<typesystem::TypeParameter*>* EmptyTypeParameters() const; | 514 V8_INLINE ZoneList<typesystem::TypeParameter*>* EmptyTypeParameters() const; |
| 515 static ZoneList<typesystem::FormalParameter*>* NullFormalParameters() { |
| 516 return nullptr; |
| 517 } |
| 513 V8_INLINE ZoneList<typesystem::FormalParameter*>* EmptyFormalParameters() | 518 V8_INLINE ZoneList<typesystem::FormalParameter*>* EmptyFormalParameters() |
| 514 const; | 519 const; |
| 515 static ZoneList<const AstRawString*>* NullIdentifierList() { return nullptr; } | 520 static ZoneList<const AstRawString*>* NullIdentifierList() { return nullptr; } |
| 516 V8_INLINE ZoneList<const AstRawString*>* EmptyIdentifierList() const; | 521 V8_INLINE ZoneList<const AstRawString*>* EmptyIdentifierList() const; |
| 517 static typesystem::Type* HoleTypeElement() { return nullptr; } | 522 static typesystem::Type* HoleTypeElement() { return nullptr; } |
| 523 V8_INLINE ZoneList<typesystem::TypeMember*>* EmptyTypeMembers() const; |
| 524 static typesystem::TypeMember* EmptyTypeMember() { return nullptr; } |
| 518 | 525 |
| 519 // Used in error return values. | 526 // Used in error return values. |
| 520 static ZoneList<Expression*>* NullExpressionList() { | 527 static ZoneList<Expression*>* NullExpressionList() { |
| 521 return NULL; | 528 return NULL; |
| 522 } | 529 } |
| 523 static const AstRawString* EmptyFormalParameter() { return NULL; } | 530 static const AstRawString* EmptyFormalParameter() { return NULL; } |
| 524 | 531 |
| 525 // Non-NULL empty string. | 532 // Non-NULL empty string. |
| 526 V8_INLINE const AstRawString* EmptyIdentifierString(); | 533 V8_INLINE const AstRawString* EmptyIdentifierString(); |
| 527 | 534 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 ZoneList<typesystem::FormalParameter*>(1, parser_->zone()); | 1138 ZoneList<typesystem::FormalParameter*>(1, parser_->zone()); |
| 1132 } | 1139 } |
| 1133 | 1140 |
| 1134 | 1141 |
| 1135 ZoneList<const AstRawString*>* ParserTraits::EmptyIdentifierList() const { | 1142 ZoneList<const AstRawString*>* ParserTraits::EmptyIdentifierList() const { |
| 1136 return new (parser_->zone()) | 1143 return new (parser_->zone()) |
| 1137 ZoneList<const AstRawString*>(1, parser_->zone()); | 1144 ZoneList<const AstRawString*>(1, parser_->zone()); |
| 1138 } | 1145 } |
| 1139 | 1146 |
| 1140 | 1147 |
| 1148 ZoneList<typesystem::TypeMember*>* ParserTraits::EmptyTypeMembers() const { |
| 1149 return new (parser_->zone()) |
| 1150 ZoneList<typesystem::TypeMember*>(4, parser_->zone()); |
| 1151 } |
| 1152 |
| 1153 |
| 1141 const AstRawString* ParserTraits::EmptyIdentifierString() { | 1154 const AstRawString* ParserTraits::EmptyIdentifierString() { |
| 1142 return parser_->ast_value_factory()->empty_string(); | 1155 return parser_->ast_value_factory()->empty_string(); |
| 1143 } | 1156 } |
| 1144 | 1157 |
| 1145 | 1158 |
| 1146 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, | 1159 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, |
| 1147 int* expected_property_count, bool* ok, | 1160 int* expected_property_count, bool* ok, |
| 1148 Scanner::BookmarkScope* bookmark) { | 1161 Scanner::BookmarkScope* bookmark) { |
| 1149 return parser_->SkipLazyFunctionBody(materialized_literal_count, | 1162 return parser_->SkipLazyFunctionBody(materialized_literal_count, |
| 1150 expected_property_count, ok, bookmark); | 1163 expected_property_count, ok, bookmark); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 | 1306 |
| 1294 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1307 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1295 return parser_->ParseDoExpression(ok); | 1308 return parser_->ParseDoExpression(ok); |
| 1296 } | 1309 } |
| 1297 | 1310 |
| 1298 | 1311 |
| 1299 } // namespace internal | 1312 } // namespace internal |
| 1300 } // namespace v8 | 1313 } // namespace v8 |
| 1301 | 1314 |
| 1302 #endif // V8_PARSING_PARSER_H_ | 1315 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |