| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 531 |
| 532 // Producing data during the recursive descent. | 532 // Producing data during the recursive descent. |
| 533 const AstRawString* GetSymbol(Scanner* scanner); | 533 const AstRawString* GetSymbol(Scanner* scanner); |
| 534 const AstRawString* GetNextSymbol(Scanner* scanner); | 534 const AstRawString* GetNextSymbol(Scanner* scanner); |
| 535 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 535 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
| 536 | 536 |
| 537 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, | 537 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 538 int pos = RelocInfo::kNoPosition); | 538 int pos = RelocInfo::kNoPosition); |
| 539 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, | 539 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, |
| 540 int pos = RelocInfo::kNoPosition); | 540 int pos = RelocInfo::kNoPosition); |
| 541 Expression* ClassExpression(const AstRawString* name, Expression* extends, | |
| 542 Expression* constructor, | |
| 543 ZoneList<ObjectLiteral::Property*>* properties, | |
| 544 int start_position, int end_position, | |
| 545 AstNodeFactory* factory); | |
| 546 | |
| 547 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 541 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 548 int end_pos); | 542 int end_pos); |
| 549 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 543 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 550 AstNodeFactory* factory); | 544 AstNodeFactory* factory); |
| 551 Expression* ExpressionFromIdentifier(const AstRawString* name, int pos, | 545 Expression* ExpressionFromIdentifier(const AstRawString* name, int pos, |
| 552 Scope* scope, AstNodeFactory* factory); | 546 Scope* scope, AstNodeFactory* factory); |
| 553 Expression* ExpressionFromString(int pos, Scanner* scanner, | 547 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| 554 AstNodeFactory* factory); | 548 AstNodeFactory* factory); |
| 555 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); | 549 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); |
| 556 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 550 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 576 const AstRawString* name, Scanner::Location function_name_location, | 570 const AstRawString* name, Scanner::Location function_name_location, |
| 577 bool name_is_strict_reserved, FunctionKind kind, | 571 bool name_is_strict_reserved, FunctionKind kind, |
| 578 int function_token_position, FunctionLiteral::FunctionType type, | 572 int function_token_position, FunctionLiteral::FunctionType type, |
| 579 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 573 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
| 580 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, | 574 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, |
| 581 int* materialized_literal_count, | 575 int* materialized_literal_count, |
| 582 int* expected_property_count, bool* ok); | 576 int* expected_property_count, bool* ok); |
| 583 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 577 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
| 584 const AstRawString* name, int pos, Variable* fvar, | 578 const AstRawString* name, int pos, Variable* fvar, |
| 585 Token::Value fvar_init_op, bool is_generator, bool* ok); | 579 Token::Value fvar_init_op, bool is_generator, bool* ok); |
| 580 |
| 581 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 582 Scanner::Location class_name_location, |
| 583 bool name_is_strict_reserved, int pos, |
| 584 bool* ok); |
| 585 |
| 586 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 586 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
| 587 bool* ok); | 587 bool* ok); |
| 588 | 588 |
| 589 private: | 589 private: |
| 590 Parser* parser_; | 590 Parser* parser_; |
| 591 }; | 591 }; |
| 592 | 592 |
| 593 | 593 |
| 594 class Parser : public ParserBase<ParserTraits> { | 594 class Parser : public ParserBase<ParserTraits> { |
| 595 public: | 595 public: |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 Scope* inner_scope, ZoneList<const AstRawString*>* names, | 756 Scope* inner_scope, ZoneList<const AstRawString*>* names, |
| 757 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 757 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
| 758 Statement* body, bool* ok); | 758 Statement* body, bool* ok); |
| 759 | 759 |
| 760 FunctionLiteral* ParseFunctionLiteral( | 760 FunctionLiteral* ParseFunctionLiteral( |
| 761 const AstRawString* name, Scanner::Location function_name_location, | 761 const AstRawString* name, Scanner::Location function_name_location, |
| 762 bool name_is_strict_reserved, FunctionKind kind, | 762 bool name_is_strict_reserved, FunctionKind kind, |
| 763 int function_token_position, FunctionLiteral::FunctionType type, | 763 int function_token_position, FunctionLiteral::FunctionType type, |
| 764 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 764 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
| 765 | 765 |
| 766 |
| 767 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 768 Scanner::Location class_name_location, |
| 769 bool name_is_strict_reserved, int pos, |
| 770 bool* ok); |
| 771 |
| 766 // Magical syntax support. | 772 // Magical syntax support. |
| 767 Expression* ParseV8Intrinsic(bool* ok); | 773 Expression* ParseV8Intrinsic(bool* ok); |
| 768 | 774 |
| 769 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); | 775 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); |
| 770 | 776 |
| 771 // Get odd-ball literals. | 777 // Get odd-ball literals. |
| 772 Literal* GetLiteralUndefined(int position); | 778 Literal* GetLiteralUndefined(int position); |
| 773 | 779 |
| 774 // For harmony block scoping mode: Check if the scope has conflicting var/let | 780 // For harmony block scoping mode: Check if the scope has conflicting var/let |
| 775 // declarations from different scopes. It covers for example | 781 // declarations from different scopes. It covers for example |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 private: | 921 private: |
| 916 static const int kLiteralTypeSlot = 0; | 922 static const int kLiteralTypeSlot = 0; |
| 917 static const int kElementsSlot = 1; | 923 static const int kElementsSlot = 1; |
| 918 | 924 |
| 919 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 925 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 920 }; | 926 }; |
| 921 | 927 |
| 922 } } // namespace v8::internal | 928 } } // namespace v8::internal |
| 923 | 929 |
| 924 #endif // V8_PARSER_H_ | 930 #endif // V8_PARSER_H_ |
| OLD | NEW |