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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 typedef v8::internal::Zone Zone; | 356 typedef v8::internal::Zone Zone; |
357 | 357 |
358 typedef v8::internal::AstProperties AstProperties; | 358 typedef v8::internal::AstProperties AstProperties; |
359 typedef Vector<VariableProxy*> ParameterIdentifierVector; | 359 typedef Vector<VariableProxy*> ParameterIdentifierVector; |
360 | 360 |
361 // Return types for traversing functions. | 361 // Return types for traversing functions. |
362 typedef const AstRawString* Identifier; | 362 typedef const AstRawString* Identifier; |
363 typedef v8::internal::Expression* Expression; | 363 typedef v8::internal::Expression* Expression; |
364 typedef Yield* YieldExpression; | 364 typedef Yield* YieldExpression; |
365 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 365 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 366 typedef v8::internal::ClassLiteral* ClassLiteral; |
366 typedef v8::internal::Literal* Literal; | 367 typedef v8::internal::Literal* Literal; |
367 typedef ObjectLiteral::Property* ObjectLiteralProperty; | 368 typedef ObjectLiteral::Property* ObjectLiteralProperty; |
368 typedef ZoneList<v8::internal::Expression*>* ExpressionList; | 369 typedef ZoneList<v8::internal::Expression*>* ExpressionList; |
369 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; | 370 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; |
370 typedef ZoneList<v8::internal::Statement*>* StatementList; | 371 typedef ZoneList<v8::internal::Statement*>* StatementList; |
371 | 372 |
372 // For constructing objects returned by the traversing functions. | 373 // For constructing objects returned by the traversing functions. |
373 typedef AstNodeFactory<AstConstructionVisitor> Factory; | 374 typedef AstNodeFactory<AstConstructionVisitor> Factory; |
374 }; | 375 }; |
375 | 376 |
(...skipping 18 matching lines...) Expand all Loading... |
394 | 395 |
395 // Helper functions for recursive descent. | 396 // Helper functions for recursive descent. |
396 bool IsEvalOrArguments(const AstRawString* identifier) const; | 397 bool IsEvalOrArguments(const AstRawString* identifier) const; |
397 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; | 398 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; |
398 | 399 |
399 // Returns true if the expression is of type "this.foo". | 400 // Returns true if the expression is of type "this.foo". |
400 static bool IsThisProperty(Expression* expression); | 401 static bool IsThisProperty(Expression* expression); |
401 | 402 |
402 static bool IsIdentifier(Expression* expression); | 403 static bool IsIdentifier(Expression* expression); |
403 | 404 |
| 405 bool IsPrototype(const AstRawString* identifier) const; |
| 406 |
| 407 bool IsConstructor(const AstRawString* identifier) const; |
| 408 |
404 static const AstRawString* AsIdentifier(Expression* expression) { | 409 static const AstRawString* AsIdentifier(Expression* expression) { |
405 DCHECK(IsIdentifier(expression)); | 410 DCHECK(IsIdentifier(expression)); |
406 return expression->AsVariableProxy()->raw_name(); | 411 return expression->AsVariableProxy()->raw_name(); |
407 } | 412 } |
408 | 413 |
409 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { | 414 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
410 return ObjectLiteral::IsBoilerplateProperty(property); | 415 return ObjectLiteral::IsBoilerplateProperty(property); |
411 } | 416 } |
412 | 417 |
413 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 418 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 return NULL; | 516 return NULL; |
512 } | 517 } |
513 static Expression* EmptyExpression() { | 518 static Expression* EmptyExpression() { |
514 return NULL; | 519 return NULL; |
515 } | 520 } |
516 static Expression* EmptyArrowParamList() { return NULL; } | 521 static Expression* EmptyArrowParamList() { return NULL; } |
517 static Literal* EmptyLiteral() { | 522 static Literal* EmptyLiteral() { |
518 return NULL; | 523 return NULL; |
519 } | 524 } |
520 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } | 525 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } |
| 526 static ClassLiteral* EmptyClassLiteral() { return NULL; } |
521 | 527 |
522 // Used in error return values. | 528 // Used in error return values. |
523 static ZoneList<Expression*>* NullExpressionList() { | 529 static ZoneList<Expression*>* NullExpressionList() { |
524 return NULL; | 530 return NULL; |
525 } | 531 } |
526 | 532 |
527 // Non-NULL empty string. | 533 // Non-NULL empty string. |
528 V8_INLINE const AstRawString* EmptyIdentifierString(); | 534 V8_INLINE const AstRawString* EmptyIdentifierString(); |
529 | 535 |
530 // Odd-ball literal creators. | 536 // Odd-ball literal creators. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 Module* ParseModulePath(bool* ok); | 694 Module* ParseModulePath(bool* ok); |
689 Module* ParseModuleVariable(bool* ok); | 695 Module* ParseModuleVariable(bool* ok); |
690 Module* ParseModuleUrl(bool* ok); | 696 Module* ParseModuleUrl(bool* ok); |
691 Module* ParseModuleSpecifier(bool* ok); | 697 Module* ParseModuleSpecifier(bool* ok); |
692 Block* ParseImportDeclaration(bool* ok); | 698 Block* ParseImportDeclaration(bool* ok); |
693 Statement* ParseExportDeclaration(bool* ok); | 699 Statement* ParseExportDeclaration(bool* ok); |
694 Statement* ParseBlockElement(ZoneList<const AstRawString*>* labels, bool* ok); | 700 Statement* ParseBlockElement(ZoneList<const AstRawString*>* labels, bool* ok); |
695 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, bool* ok); | 701 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, bool* ok); |
696 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, | 702 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, |
697 bool* ok); | 703 bool* ok); |
| 704 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
| 705 bool* ok); |
698 Statement* ParseNativeDeclaration(bool* ok); | 706 Statement* ParseNativeDeclaration(bool* ok); |
699 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); | 707 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); |
700 Block* ParseVariableStatement(VariableDeclarationContext var_context, | 708 Block* ParseVariableStatement(VariableDeclarationContext var_context, |
701 ZoneList<const AstRawString*>* names, | 709 ZoneList<const AstRawString*>* names, |
702 bool* ok); | 710 bool* ok); |
703 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, | 711 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, |
704 VariableDeclarationProperties* decl_props, | 712 VariableDeclarationProperties* decl_props, |
705 ZoneList<const AstRawString*>* names, | 713 ZoneList<const AstRawString*>* names, |
706 const AstRawString** out, | 714 const AstRawString** out, |
707 bool* ok); | 715 bool* ok); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 private: | 909 private: |
902 static const int kLiteralTypeSlot = 0; | 910 static const int kLiteralTypeSlot = 0; |
903 static const int kElementsSlot = 1; | 911 static const int kElementsSlot = 1; |
904 | 912 |
905 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 913 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
906 }; | 914 }; |
907 | 915 |
908 } } // namespace v8::internal | 916 } } // namespace v8::internal |
909 | 917 |
910 #endif // V8_PARSER_H_ | 918 #endif // V8_PARSER_H_ |
OLD | NEW |