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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 const AstRawString* GetSymbol(Scanner* scanner); | 535 const AstRawString* GetSymbol(Scanner* scanner); |
536 const AstRawString* GetNextSymbol(Scanner* scanner); | 536 const AstRawString* GetNextSymbol(Scanner* scanner); |
537 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 537 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
538 | 538 |
539 Expression* ThisExpression(Scope* scope, | 539 Expression* ThisExpression(Scope* scope, |
540 AstNodeFactory<AstConstructionVisitor>* factory, | 540 AstNodeFactory<AstConstructionVisitor>* factory, |
541 int pos = RelocInfo::kNoPosition); | 541 int pos = RelocInfo::kNoPosition); |
542 Expression* SuperReference(Scope* scope, | 542 Expression* SuperReference(Scope* scope, |
543 AstNodeFactory<AstConstructionVisitor>* factory, | 543 AstNodeFactory<AstConstructionVisitor>* factory, |
544 int pos = RelocInfo::kNoPosition); | 544 int pos = RelocInfo::kNoPosition); |
545 Expression* ClassExpression(const AstRawString* name, Expression* extends, | |
546 Expression* constructor, | |
547 ZoneList<ObjectLiteral::Property*>* properties, | |
548 int start_position, int end_position, | |
549 AstNodeFactory<AstConstructionVisitor>* factory); | |
550 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 545 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
551 int end_pos); | 546 int end_pos); |
552 Literal* ExpressionFromLiteral( | 547 Literal* ExpressionFromLiteral( |
553 Token::Value token, int pos, Scanner* scanner, | 548 Token::Value token, int pos, Scanner* scanner, |
554 AstNodeFactory<AstConstructionVisitor>* factory); | 549 AstNodeFactory<AstConstructionVisitor>* factory); |
555 Expression* ExpressionFromIdentifier( | 550 Expression* ExpressionFromIdentifier( |
556 const AstRawString* name, int pos, Scope* scope, | 551 const AstRawString* name, int pos, Scope* scope, |
557 AstNodeFactory<AstConstructionVisitor>* factory); | 552 AstNodeFactory<AstConstructionVisitor>* factory); |
558 Expression* ExpressionFromString( | 553 Expression* ExpressionFromString( |
559 int pos, Scanner* scanner, | 554 int pos, Scanner* scanner, |
(...skipping 23 matching lines...) Expand all Loading... |
583 const AstRawString* name, Scanner::Location function_name_location, | 578 const AstRawString* name, Scanner::Location function_name_location, |
584 bool name_is_strict_reserved, FunctionKind kind, | 579 bool name_is_strict_reserved, FunctionKind kind, |
585 int function_token_position, FunctionLiteral::FunctionType type, | 580 int function_token_position, FunctionLiteral::FunctionType type, |
586 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 581 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
587 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, | 582 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, |
588 int* materialized_literal_count, | 583 int* materialized_literal_count, |
589 int* expected_property_count, bool* ok); | 584 int* expected_property_count, bool* ok); |
590 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 585 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
591 const AstRawString* name, int pos, Variable* fvar, | 586 const AstRawString* name, int pos, Variable* fvar, |
592 Token::Value fvar_init_op, bool is_generator, bool* ok); | 587 Token::Value fvar_init_op, bool is_generator, bool* ok); |
| 588 |
| 589 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 590 Scanner::Location class_name_location, |
| 591 bool name_is_strict_reserved, int pos, |
| 592 bool* ok); |
| 593 |
593 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 594 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
594 bool* ok); | 595 bool* ok); |
595 | 596 |
596 private: | 597 private: |
597 Parser* parser_; | 598 Parser* parser_; |
598 }; | 599 }; |
599 | 600 |
600 | 601 |
601 class Parser : public ParserBase<ParserTraits> { | 602 class Parser : public ParserBase<ParserTraits> { |
602 public: | 603 public: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 Scope* inner_scope, ZoneList<const AstRawString*>* names, | 764 Scope* inner_scope, ZoneList<const AstRawString*>* names, |
764 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 765 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
765 Statement* body, bool* ok); | 766 Statement* body, bool* ok); |
766 | 767 |
767 FunctionLiteral* ParseFunctionLiteral( | 768 FunctionLiteral* ParseFunctionLiteral( |
768 const AstRawString* name, Scanner::Location function_name_location, | 769 const AstRawString* name, Scanner::Location function_name_location, |
769 bool name_is_strict_reserved, FunctionKind kind, | 770 bool name_is_strict_reserved, FunctionKind kind, |
770 int function_token_position, FunctionLiteral::FunctionType type, | 771 int function_token_position, FunctionLiteral::FunctionType type, |
771 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 772 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
772 | 773 |
| 774 |
| 775 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 776 Scanner::Location class_name_location, |
| 777 bool name_is_strict_reserved, int pos, |
| 778 bool* ok); |
| 779 |
773 // Magical syntax support. | 780 // Magical syntax support. |
774 Expression* ParseV8Intrinsic(bool* ok); | 781 Expression* ParseV8Intrinsic(bool* ok); |
775 | 782 |
776 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); | 783 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); |
777 | 784 |
778 // Get odd-ball literals. | 785 // Get odd-ball literals. |
779 Literal* GetLiteralUndefined(int position); | 786 Literal* GetLiteralUndefined(int position); |
780 | 787 |
781 // For harmony block scoping mode: Check if the scope has conflicting var/let | 788 // For harmony block scoping mode: Check if the scope has conflicting var/let |
782 // declarations from different scopes. It covers for example | 789 // declarations from different scopes. It covers for example |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 private: | 929 private: |
923 static const int kLiteralTypeSlot = 0; | 930 static const int kLiteralTypeSlot = 0; |
924 static const int kElementsSlot = 1; | 931 static const int kElementsSlot = 1; |
925 | 932 |
926 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 933 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
927 }; | 934 }; |
928 | 935 |
929 } } // namespace v8::internal | 936 } } // namespace v8::internal |
930 | 937 |
931 #endif // V8_PARSER_H_ | 938 #endif // V8_PARSER_H_ |
OLD | NEW |