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

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: 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1611
1612 1612
1613 enum SourceElements { 1613 enum SourceElements {
1614 kUnknownSourceElements 1614 kUnknownSourceElements
1615 }; 1615 };
1616 1616
1617 // All ParseXXX functions take as the last argument an *ok parameter 1617 // All ParseXXX functions take as the last argument an *ok parameter
1618 // which is set to false if parsing failed; it is unchanged otherwise. 1618 // which is set to false if parsing failed; it is unchanged otherwise.
1619 // By making the 'exception handling' explicit, we are forced to check 1619 // By making the 'exception handling' explicit, we are forced to check
1620 // for failure at the call sites. 1620 // for failure at the call sites.
1621 Statement ParseSourceElement(bool* ok); 1621 Statement ParseStatementListItem(bool* ok);
1622 SourceElements ParseSourceElements(int end_token, bool* ok); 1622 SourceElements ParseStatementList(int end_token, bool* ok);
adamk 2015/02/06 22:24:15 You could also rename the return value, although i
arv (Not doing code reviews) 2015/02/06 22:53:44 Done. The return value was never used.
1623 Statement ParseStatement(bool* ok); 1623 Statement ParseStatement(bool* ok);
1624 Statement ParseFunctionDeclaration(bool* ok); 1624 Statement ParseFunctionDeclaration(bool* ok);
1625 Statement ParseClassDeclaration(bool* ok); 1625 Statement ParseClassDeclaration(bool* ok);
1626 Statement ParseBlock(bool* ok); 1626 Statement ParseBlock(bool* ok);
1627 Statement ParseVariableStatement(VariableDeclarationContext var_context, 1627 Statement ParseVariableStatement(VariableDeclarationContext var_context,
1628 bool* ok); 1628 bool* ok);
1629 Statement ParseVariableDeclarations(VariableDeclarationContext var_context, 1629 Statement ParseVariableDeclarations(VariableDeclarationContext var_context,
1630 VariableDeclarationProperties* decl_props, 1630 VariableDeclarationProperties* decl_props,
1631 int* num_decl, 1631 int* num_decl,
1632 bool* ok); 1632 bool* ok);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1675 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1676 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1676 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1677 } 1677 }
1678 1678
1679 1679
1680 PreParserStatementList PreParser::ParseEagerFunctionBody( 1680 PreParserStatementList PreParser::ParseEagerFunctionBody(
1681 PreParserIdentifier function_name, int pos, Variable* fvar, 1681 PreParserIdentifier function_name, int pos, Variable* fvar,
1682 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 1682 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
1683 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); 1683 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
1684 1684
1685 ParseSourceElements(Token::RBRACE, ok); 1685 ParseStatementList(Token::RBRACE, ok);
1686 if (!*ok) return PreParserStatementList(); 1686 if (!*ok) return PreParserStatementList();
1687 1687
1688 Expect(Token::RBRACE, ok); 1688 Expect(Token::RBRACE, ok);
1689 return PreParserStatementList(); 1689 return PreParserStatementList();
1690 } 1690 }
1691 1691
1692 1692
1693 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( 1693 PreParserStatementList PreParserTraits::ParseEagerFunctionBody(
1694 PreParserIdentifier function_name, int pos, Variable* fvar, 1694 PreParserIdentifier function_name, int pos, Variable* fvar,
1695 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 1695 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 *ok = false; 3109 *ok = false;
3110 return; 3110 return;
3111 } 3111 }
3112 has_seen_constructor_ = true; 3112 has_seen_constructor_ = true;
3113 return; 3113 return;
3114 } 3114 }
3115 } 3115 }
3116 } } // v8::internal 3116 } } // v8::internal
3117 3117
3118 #endif // V8_PREPARSER_H 3118 #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