| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 int* materialized_literal_count, int* expected_property_count, bool* ok, | 609 int* materialized_literal_count, int* expected_property_count, bool* ok, |
| 610 Scanner::BookmarkScope* bookmark = nullptr); | 610 Scanner::BookmarkScope* bookmark = nullptr); |
| 611 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 611 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
| 612 const AstRawString* name, int pos, | 612 const AstRawString* name, int pos, |
| 613 const ParserFormalParameters& parameters, FunctionKind kind, | 613 const ParserFormalParameters& parameters, FunctionKind kind, |
| 614 FunctionLiteral::FunctionType function_type, bool* ok); | 614 FunctionLiteral::FunctionType function_type, bool* ok); |
| 615 | 615 |
| 616 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 616 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 617 Scanner::Location class_name_location, | 617 Scanner::Location class_name_location, |
| 618 bool name_is_strict_reserved, int pos, | 618 bool name_is_strict_reserved, int pos, |
| 619 bool* ok); | 619 bool ambient, bool* ok); |
| 620 | 620 |
| 621 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 621 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
| 622 bool* ok); | 622 bool* ok); |
| 623 | 623 |
| 624 class TemplateLiteral : public ZoneObject { | 624 class TemplateLiteral : public ZoneObject { |
| 625 public: | 625 public: |
| 626 TemplateLiteral(Zone* zone, int pos) | 626 TemplateLiteral(Zone* zone, int pos) |
| 627 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} | 627 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} |
| 628 | 628 |
| 629 const ZoneList<Expression*>* cooked() const { return &cooked_; } | 629 const ZoneList<Expression*>* cooked() const { return &cooked_; } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 ZoneList<ImportDeclaration*>* ParseNamedImports(int pos, bool* ok); | 799 ZoneList<ImportDeclaration*>* ParseNamedImports(int pos, bool* ok); |
| 800 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, | 800 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, |
| 801 AllowLabelledFunctionStatement allow_function, | 801 AllowLabelledFunctionStatement allow_function, |
| 802 bool* ok); | 802 bool* ok); |
| 803 Statement* ParseSubStatement(ZoneList<const AstRawString*>* labels, | 803 Statement* ParseSubStatement(ZoneList<const AstRawString*>* labels, |
| 804 AllowLabelledFunctionStatement allow_function, | 804 AllowLabelledFunctionStatement allow_function, |
| 805 bool* ok); | 805 bool* ok); |
| 806 Statement* ParseStatementAsUnlabelled(ZoneList<const AstRawString*>* labels, | 806 Statement* ParseStatementAsUnlabelled(ZoneList<const AstRawString*>* labels, |
| 807 bool* ok); | 807 bool* ok); |
| 808 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, | 808 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, |
| 809 bool* ok); | 809 bool ambient, bool* ok); |
| 810 Statement* ParseFunctionDeclaration(int pos, bool is_generator, | 810 Statement* ParseFunctionDeclaration(int pos, bool is_generator, |
| 811 ZoneList<const AstRawString*>* names, | 811 ZoneList<const AstRawString*>* names, |
| 812 bool* ok); | 812 bool ambient, bool* ok); |
| 813 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 813 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
| 814 bool* ok); | 814 bool ambient, bool* ok); |
| 815 Statement* ParseNativeDeclaration(bool* ok); | 815 Statement* ParseNativeDeclaration(bool* ok); |
| 816 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); | 816 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); |
| 817 Block* ParseBlock(ZoneList<const AstRawString*>* labels, | 817 Block* ParseBlock(ZoneList<const AstRawString*>* labels, |
| 818 bool finalize_block_scope, bool* ok); | 818 bool finalize_block_scope, bool* ok); |
| 819 Block* ParseVariableStatement(VariableDeclarationContext var_context, | 819 Block* ParseVariableStatement(VariableDeclarationContext var_context, |
| 820 ZoneList<const AstRawString*>* names, | 820 ZoneList<const AstRawString*>* names, |
| 821 bool* ok); | 821 bool ambient, bool* ok); |
| 822 DoExpression* ParseDoExpression(bool* ok); | 822 DoExpression* ParseDoExpression(bool* ok); |
| 823 Expression* ParseYieldStarExpression(bool* ok); | 823 Expression* ParseYieldStarExpression(bool* ok); |
| 824 | 824 |
| 825 struct DeclarationDescriptor { | 825 struct DeclarationDescriptor { |
| 826 enum Kind { NORMAL, PARAMETER }; | 826 enum Kind { NORMAL, PARAMETER }; |
| 827 Parser* parser; | 827 Parser* parser; |
| 828 Scope* scope; | 828 Scope* scope; |
| 829 Scope* hoist_scope; | 829 Scope* hoist_scope; |
| 830 VariableMode mode; | 830 VariableMode mode; |
| 831 int declaration_pos; | 831 int declaration_pos; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 const DeclarationDescriptor* descriptor_; | 935 const DeclarationDescriptor* descriptor_; |
| 936 ZoneList<const AstRawString*>* names_; | 936 ZoneList<const AstRawString*>* names_; |
| 937 Expression* current_value_; | 937 Expression* current_value_; |
| 938 int recursion_level_; | 938 int recursion_level_; |
| 939 bool* ok_; | 939 bool* ok_; |
| 940 }; | 940 }; |
| 941 | 941 |
| 942 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, | 942 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, |
| 943 DeclarationParsingResult* parsing_result, | 943 DeclarationParsingResult* parsing_result, |
| 944 ZoneList<const AstRawString*>* names, | 944 ZoneList<const AstRawString*>* names, |
| 945 bool* ok); | 945 bool ambient, bool* ok); |
| 946 Statement* ParseExpressionOrLabelledStatement( | 946 Statement* ParseExpressionOrLabelledStatement( |
| 947 ZoneList<const AstRawString*>* labels, | 947 ZoneList<const AstRawString*>* labels, |
| 948 AllowLabelledFunctionStatement allow_function, bool* ok); | 948 AllowLabelledFunctionStatement allow_function, bool* ok); |
| 949 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, | 949 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, |
| 950 bool* ok); | 950 bool* ok); |
| 951 Statement* ParseContinueStatement(bool* ok); | 951 Statement* ParseContinueStatement(bool* ok); |
| 952 Statement* ParseBreakStatement(ZoneList<const AstRawString*>* labels, | 952 Statement* ParseBreakStatement(ZoneList<const AstRawString*>* labels, |
| 953 bool* ok); | 953 bool* ok); |
| 954 Statement* ParseReturnStatement(bool* ok); | 954 Statement* ParseReturnStatement(bool* ok); |
| 955 Statement* ParseWithStatement(ZoneList<const AstRawString*>* labels, | 955 Statement* ParseWithStatement(ZoneList<const AstRawString*>* labels, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 FunctionLiteral* ParseFunctionLiteral( | 999 FunctionLiteral* ParseFunctionLiteral( |
| 1000 const AstRawString* name, Scanner::Location function_name_location, | 1000 const AstRawString* name, Scanner::Location function_name_location, |
| 1001 FunctionNameValidity function_name_validity, FunctionKind kind, | 1001 FunctionNameValidity function_name_validity, FunctionKind kind, |
| 1002 int function_token_position, FunctionLiteral::FunctionType type, | 1002 int function_token_position, FunctionLiteral::FunctionType type, |
| 1003 LanguageMode language_mode, typesystem::TypeFlags type_flags, bool* ok); | 1003 LanguageMode language_mode, typesystem::TypeFlags type_flags, bool* ok); |
| 1004 | 1004 |
| 1005 | 1005 |
| 1006 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1006 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 1007 Scanner::Location class_name_location, | 1007 Scanner::Location class_name_location, |
| 1008 bool name_is_strict_reserved, int pos, | 1008 bool name_is_strict_reserved, int pos, |
| 1009 bool* ok); | 1009 bool ambient, bool* ok); |
| 1010 | 1010 |
| 1011 // Magical syntax support. | 1011 // Magical syntax support. |
| 1012 Expression* ParseV8Intrinsic(bool* ok); | 1012 Expression* ParseV8Intrinsic(bool* ok); |
| 1013 | 1013 |
| 1014 // Get odd-ball literals. | 1014 // Get odd-ball literals. |
| 1015 Literal* GetLiteralUndefined(int position); | 1015 Literal* GetLiteralUndefined(int position); |
| 1016 | 1016 |
| 1017 // Check if the scope has conflicting var/let declarations from different | 1017 // Check if the scope has conflicting var/let declarations from different |
| 1018 // scopes. This covers for example | 1018 // scopes. This covers for example |
| 1019 // | 1019 // |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 | 1323 |
| 1324 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1324 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1325 return parser_->ParseDoExpression(ok); | 1325 return parser_->ParseDoExpression(ok); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 | 1328 |
| 1329 } // namespace internal | 1329 } // namespace internal |
| 1330 } // namespace v8 | 1330 } // namespace v8 |
| 1331 | 1331 |
| 1332 #endif // V8_PARSING_PARSER_H_ | 1332 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |