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

Side by Side Diff: src/parsing/parser.h

Issue 2165513004: [parser] More CHECK_OK cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 5 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 | « no previous file | src/parsing/parser.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_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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 ParseErrorType error_type = kSyntaxError); 468 ParseErrorType error_type = kSyntaxError);
469 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, 469 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL,
470 ParseErrorType error_type = kSyntaxError); 470 ParseErrorType error_type = kSyntaxError);
471 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg, 471 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg,
472 ParseErrorType error_type = kSyntaxError); 472 ParseErrorType error_type = kSyntaxError);
473 void ReportMessageAt(Scanner::Location source_location, 473 void ReportMessageAt(Scanner::Location source_location,
474 MessageTemplate::Template message, 474 MessageTemplate::Template message,
475 const AstRawString* arg, 475 const AstRawString* arg,
476 ParseErrorType error_type = kSyntaxError); 476 ParseErrorType error_type = kSyntaxError);
477 477
478 // A dummy function, just useful as an argument to CHECK_OK_CUSTOM.
479 static void Void() {}
480
481 // "null" return type creators. 478 // "null" return type creators.
482 static const AstRawString* EmptyIdentifier() { 479 static const AstRawString* EmptyIdentifier() {
483 return NULL; 480 return NULL;
484 } 481 }
485 static Expression* EmptyExpression() { 482 static Expression* EmptyExpression() {
486 return NULL; 483 return NULL;
487 } 484 }
488 static Literal* EmptyLiteral() { 485 static Literal* EmptyLiteral() {
489 return NULL; 486 return NULL;
490 } 487 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 cached_parse_data_ != NULL; 755 cached_parse_data_ != NULL;
759 } 756 }
760 bool produce_cached_parse_data() const { 757 bool produce_cached_parse_data() const {
761 return compile_options_ == ScriptCompiler::kProduceParserCache; 758 return compile_options_ == ScriptCompiler::kProduceParserCache;
762 } 759 }
763 760
764 // All ParseXXX functions take as the last argument an *ok parameter 761 // All ParseXXX functions take as the last argument an *ok parameter
765 // which is set to false if parsing failed; it is unchanged otherwise. 762 // which is set to false if parsing failed; it is unchanged otherwise.
766 // By making the 'exception handling' explicit, we are forced to check 763 // By making the 'exception handling' explicit, we are forced to check
767 // for failure at the call sites. 764 // for failure at the call sites.
768 void* ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok); 765 void ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok);
769 Statement* ParseStatementListItem(bool* ok); 766 Statement* ParseStatementListItem(bool* ok);
770 void* ParseModuleItemList(ZoneList<Statement*>* body, bool* ok); 767 void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok);
771 Statement* ParseModuleItem(bool* ok); 768 Statement* ParseModuleItem(bool* ok);
772 const AstRawString* ParseModuleSpecifier(bool* ok); 769 const AstRawString* ParseModuleSpecifier(bool* ok);
773 void* ParseImportDeclaration(bool* ok); 770 void ParseImportDeclaration(bool* ok);
774 Statement* ParseExportDeclaration(bool* ok); 771 Statement* ParseExportDeclaration(bool* ok);
775 Statement* ParseExportDefault(bool* ok); 772 Statement* ParseExportDefault(bool* ok);
776 void* ParseExportClause(ZoneList<const AstRawString*>* export_names, 773 void ParseExportClause(ZoneList<const AstRawString*>* export_names,
777 ZoneList<Scanner::Location>* export_locations, 774 ZoneList<Scanner::Location>* export_locations,
778 ZoneList<const AstRawString*>* local_names, 775 ZoneList<const AstRawString*>* local_names,
779 Scanner::Location* reserved_loc, bool* ok); 776 Scanner::Location* reserved_loc, bool* ok);
780 struct NamedImport : public ZoneObject { 777 struct NamedImport : public ZoneObject {
781 const AstRawString* import_name; 778 const AstRawString* import_name;
782 const AstRawString* local_name; 779 const AstRawString* local_name;
783 const Scanner::Location location; 780 const Scanner::Location location;
784 NamedImport(const AstRawString* import_name, const AstRawString* local_name, 781 NamedImport(const AstRawString* import_name, const AstRawString* local_name,
785 Scanner::Location location) 782 Scanner::Location location)
786 : import_name(import_name), 783 : import_name(import_name),
787 local_name(local_name), 784 local_name(local_name),
788 location(location) {} 785 location(location) {}
789 }; 786 };
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3 1031 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3
1035 void InsertSloppyBlockFunctionVarBindings(Scope* scope, 1032 void InsertSloppyBlockFunctionVarBindings(Scope* scope,
1036 Scope* complex_params_scope, 1033 Scope* complex_params_scope,
1037 bool* ok); 1034 bool* ok);
1038 1035
1039 // Parser support 1036 // Parser support
1040 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); 1037 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
1041 Variable* Declare(Declaration* declaration, 1038 Variable* Declare(Declaration* declaration,
1042 DeclarationDescriptor::Kind declaration_kind, bool resolve, 1039 DeclarationDescriptor::Kind declaration_kind, bool resolve,
1043 bool* ok, Scope* declaration_scope = nullptr); 1040 bool* ok, Scope* declaration_scope = nullptr);
1044 void* DeclareImport(const AstRawString* local_name, int pos, bool* ok); 1041 void DeclareImport(const AstRawString* local_name, int pos, bool* ok);
1045 1042
1046 bool TargetStackContainsLabel(const AstRawString* label); 1043 bool TargetStackContainsLabel(const AstRawString* label);
1047 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1044 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1048 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1045 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1049 1046
1050 Statement* BuildAssertIsCoercible(Variable* var); 1047 Statement* BuildAssertIsCoercible(Variable* var);
1051 1048
1052 // Factory methods. 1049 // Factory methods.
1053 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, 1050 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
1054 Scope* scope, int pos, int end_pos, 1051 Scope* scope, int pos, int end_pos,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 1312
1316 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1313 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1317 return parser_->ParseDoExpression(ok); 1314 return parser_->ParseDoExpression(ok);
1318 } 1315 }
1319 1316
1320 1317
1321 } // namespace internal 1318 } // namespace internal
1322 } // namespace v8 1319 } // namespace v8
1323 1320
1324 #endif // V8_PARSING_PARSER_H_ 1321 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698