Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: src/preparser.h

Issue 905003003: Rename ParseSourceElements in preparser too (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove kUnknownSourceElements Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 // success (even if parsing failed, the pre-parse data successfully 1557 // success (even if parsing failed, the pre-parse data successfully
1558 // captured the syntax error), and false if a stack-overflow happened 1558 // captured the syntax error), and false if a stack-overflow happened
1559 // during parsing. 1559 // during parsing.
1560 PreParseResult PreParseProgram(int* materialized_literals = 0) { 1560 PreParseResult PreParseProgram(int* materialized_literals = 0) {
1561 PreParserScope scope(scope_, SCRIPT_SCOPE); 1561 PreParserScope scope(scope_, SCRIPT_SCOPE);
1562 PreParserFactory factory(NULL); 1562 PreParserFactory factory(NULL);
1563 FunctionState top_scope(&function_state_, &scope_, &scope, kNormalFunction, 1563 FunctionState top_scope(&function_state_, &scope_, &scope, kNormalFunction,
1564 &factory); 1564 &factory);
1565 bool ok = true; 1565 bool ok = true;
1566 int start_position = scanner()->peek_location().beg_pos; 1566 int start_position = scanner()->peek_location().beg_pos;
1567 ParseSourceElements(Token::EOS, &ok); 1567 ParseStatementList(Token::EOS, &ok);
1568 if (stack_overflow()) return kPreParseStackOverflow; 1568 if (stack_overflow()) return kPreParseStackOverflow;
1569 if (!ok) { 1569 if (!ok) {
1570 ReportUnexpectedToken(scanner()->current_token()); 1570 ReportUnexpectedToken(scanner()->current_token());
1571 } else if (is_strict(scope_->language_mode())) { 1571 } else if (is_strict(scope_->language_mode())) {
1572 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, 1572 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos,
1573 &ok); 1573 &ok);
1574 } 1574 }
1575 if (materialized_literals) { 1575 if (materialized_literals) {
1576 *materialized_literals = function_state_->materialized_literal_count(); 1576 *materialized_literals = function_state_->materialized_literal_count();
1577 } 1577 }
(...skipping 24 matching lines...) Expand all
1602 kStatement, 1602 kStatement,
1603 kForStatement 1603 kForStatement
1604 }; 1604 };
1605 1605
1606 // If a list of variable declarations includes any initializers. 1606 // If a list of variable declarations includes any initializers.
1607 enum VariableDeclarationProperties { 1607 enum VariableDeclarationProperties {
1608 kHasInitializers, 1608 kHasInitializers,
1609 kHasNoInitializers 1609 kHasNoInitializers
1610 }; 1610 };
1611 1611
1612
1613 enum SourceElements {
1614 kUnknownSourceElements
1615 };
1616
1617 // All ParseXXX functions take as the last argument an *ok parameter 1612 // All ParseXXX functions take as the last argument an *ok parameter
1618 // which is set to false if parsing failed; it is unchanged otherwise. 1613 // which is set to false if parsing failed; it is unchanged otherwise.
1619 // By making the 'exception handling' explicit, we are forced to check 1614 // By making the 'exception handling' explicit, we are forced to check
1620 // for failure at the call sites. 1615 // for failure at the call sites.
1621 Statement ParseSourceElement(bool* ok); 1616 Statement ParseStatementListItem(bool* ok);
1622 SourceElements ParseSourceElements(int end_token, bool* ok); 1617 void ParseStatementList(int end_token, bool* ok);
1623 Statement ParseStatement(bool* ok); 1618 Statement ParseStatement(bool* ok);
1624 Statement ParseFunctionDeclaration(bool* ok); 1619 Statement ParseFunctionDeclaration(bool* ok);
1625 Statement ParseClassDeclaration(bool* ok); 1620 Statement ParseClassDeclaration(bool* ok);
1626 Statement ParseBlock(bool* ok); 1621 Statement ParseBlock(bool* ok);
1627 Statement ParseVariableStatement(VariableDeclarationContext var_context, 1622 Statement ParseVariableStatement(VariableDeclarationContext var_context,
1628 bool* ok); 1623 bool* ok);
1629 Statement ParseVariableDeclarations(VariableDeclarationContext var_context, 1624 Statement ParseVariableDeclarations(VariableDeclarationContext var_context,
1630 VariableDeclarationProperties* decl_props, 1625 VariableDeclarationProperties* decl_props,
1631 int* num_decl, 1626 int* num_decl,
1632 bool* ok); 1627 bool* ok);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1670 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1676 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1671 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1677 } 1672 }
1678 1673
1679 1674
1680 PreParserStatementList PreParser::ParseEagerFunctionBody( 1675 PreParserStatementList PreParser::ParseEagerFunctionBody(
1681 PreParserIdentifier function_name, int pos, Variable* fvar, 1676 PreParserIdentifier function_name, int pos, Variable* fvar,
1682 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 1677 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
1683 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); 1678 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
1684 1679
1685 ParseSourceElements(Token::RBRACE, ok); 1680 ParseStatementList(Token::RBRACE, ok);
1686 if (!*ok) return PreParserStatementList(); 1681 if (!*ok) return PreParserStatementList();
1687 1682
1688 Expect(Token::RBRACE, ok); 1683 Expect(Token::RBRACE, ok);
1689 return PreParserStatementList(); 1684 return PreParserStatementList();
1690 } 1685 }
1691 1686
1692 1687
1693 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( 1688 PreParserStatementList PreParserTraits::ParseEagerFunctionBody(
1694 PreParserIdentifier function_name, int pos, Variable* fvar, 1689 PreParserIdentifier function_name, int pos, Variable* fvar,
1695 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 1690 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 *ok = false; 3104 *ok = false;
3110 return; 3105 return;
3111 } 3106 }
3112 has_seen_constructor_ = true; 3107 has_seen_constructor_ = true;
3113 return; 3108 return;
3114 } 3109 }
3115 } 3110 }
3116 } } // v8::internal 3111 } } // v8::internal
3117 3112
3118 #endif // V8_PREPARSER_H 3113 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698