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/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); | 469 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); |
470 | 470 |
471 Expression* RewriteDoExpression(Block* body, int pos, bool* ok); | 471 Expression* RewriteDoExpression(Block* body, int pos, bool* ok); |
472 | 472 |
473 FunctionLiteral* ParseFunctionLiteral( | 473 FunctionLiteral* ParseFunctionLiteral( |
474 const AstRawString* name, Scanner::Location function_name_location, | 474 const AstRawString* name, Scanner::Location function_name_location, |
475 FunctionNameValidity function_name_validity, FunctionKind kind, | 475 FunctionNameValidity function_name_validity, FunctionKind kind, |
476 int function_token_position, FunctionLiteral::FunctionType type, | 476 int function_token_position, FunctionLiteral::FunctionType type, |
477 LanguageMode language_mode, bool* ok); | 477 LanguageMode language_mode, bool* ok); |
478 | 478 |
479 Expression* InstallHomeObject(Expression* function_literal, | |
480 Expression* home_object); | |
481 FunctionLiteral* SynthesizeClassFieldInitializer(int count); | |
482 FunctionLiteral* InsertClassFieldInitializer(FunctionLiteral* constructor); | |
483 | |
484 // Get odd-ball literals. | 479 // Get odd-ball literals. |
485 Literal* GetLiteralUndefined(int position); | 480 Literal* GetLiteralUndefined(int position); |
486 | 481 |
487 // Check if the scope has conflicting var/let declarations from different | 482 // Check if the scope has conflicting var/let declarations from different |
488 // scopes. This covers for example | 483 // scopes. This covers for example |
489 // | 484 // |
490 // function f() { { { var x; } let x; } } | 485 // function f() { { { var x; } let x; } } |
491 // function g() { { var x; let x; } } | 486 // function g() { { var x; let x; } } |
492 // | 487 // |
493 // The var declarations are hoisted to the function scope, but originate from | 488 // The var declarations are hoisted to the function scope, but originate from |
(...skipping 22 matching lines...) Expand all Loading... |
516 InitializationFlag init, int pos, bool* ok); | 511 InitializationFlag init, int pos, bool* ok); |
517 | 512 |
518 bool TargetStackContainsLabel(const AstRawString* label); | 513 bool TargetStackContainsLabel(const AstRawString* label); |
519 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 514 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
520 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 515 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
521 | 516 |
522 Statement* BuildAssertIsCoercible(Variable* var); | 517 Statement* BuildAssertIsCoercible(Variable* var); |
523 | 518 |
524 // Factory methods. | 519 // Factory methods. |
525 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, | 520 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, |
526 bool requires_class_field_init, int pos, | 521 int pos, int end_pos, |
527 int end_pos, LanguageMode language_mode); | 522 LanguageMode language_mode); |
528 | 523 |
529 // Skip over a lazy function, either using cached data if we have it, or | 524 // Skip over a lazy function, either using cached data if we have it, or |
530 // by parsing the function with PreParser. Consumes the ending }. | 525 // by parsing the function with PreParser. Consumes the ending }. |
531 // If may_abort == true, the (pre-)parser may decide to abort skipping | 526 // If may_abort == true, the (pre-)parser may decide to abort skipping |
532 // in order to force the function to be eagerly parsed, after all. | 527 // in order to force the function to be eagerly parsed, after all. |
533 LazyParsingResult SkipFunction( | 528 LazyParsingResult SkipFunction( |
534 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, | 529 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, |
535 int* function_length, bool* has_duplicate_parameters, | 530 int* function_length, bool* has_duplicate_parameters, |
536 int* materialized_literal_count, int* expected_property_count, | 531 int* materialized_literal_count, int* expected_property_count, |
537 bool is_inner_function, bool may_abort, bool* ok); | 532 bool is_inner_function, bool may_abort, bool* ok); |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 | 1176 |
1182 private: | 1177 private: |
1183 ParserTarget** variable_; | 1178 ParserTarget** variable_; |
1184 ParserTarget* previous_; | 1179 ParserTarget* previous_; |
1185 }; | 1180 }; |
1186 | 1181 |
1187 } // namespace internal | 1182 } // namespace internal |
1188 } // namespace v8 | 1183 } // namespace v8 |
1189 | 1184 |
1190 #endif // V8_PARSING_PARSER_H_ | 1185 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |