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

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: 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') | src/parsing/parser.cc » ('J')
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 cached_parse_data_ != NULL; 754 cached_parse_data_ != NULL;
758 } 755 }
759 bool produce_cached_parse_data() const { 756 bool produce_cached_parse_data() const {
760 return compile_options_ == ScriptCompiler::kProduceParserCache; 757 return compile_options_ == ScriptCompiler::kProduceParserCache;
761 } 758 }
762 759
763 // All ParseXXX functions take as the last argument an *ok parameter 760 // All ParseXXX functions take as the last argument an *ok parameter
764 // which is set to false if parsing failed; it is unchanged otherwise. 761 // which is set to false if parsing failed; it is unchanged otherwise.
765 // By making the 'exception handling' explicit, we are forced to check 762 // By making the 'exception handling' explicit, we are forced to check
766 // for failure at the call sites. 763 // for failure at the call sites.
767 void* ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok); 764 void ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok);
768 Statement* ParseStatementListItem(bool* ok); 765 Statement* ParseStatementListItem(bool* ok);
769 void* ParseModuleItemList(ZoneList<Statement*>* body, bool* ok); 766 void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok);
770 Statement* ParseModuleItem(bool* ok); 767 Statement* ParseModuleItem(bool* ok);
771 const AstRawString* ParseModuleSpecifier(bool* ok); 768 const AstRawString* ParseModuleSpecifier(bool* ok);
772 void* ParseImportDeclaration(bool* ok); 769 void ParseImportDeclaration(bool* ok);
773 Statement* ParseExportDeclaration(bool* ok); 770 Statement* ParseExportDeclaration(bool* ok);
774 Statement* ParseExportDefault(bool* ok); 771 Statement* ParseExportDefault(bool* ok);
775 void* ParseExportClause(ZoneList<const AstRawString*>* export_names, 772 void ParseExportClause(ZoneList<const AstRawString*>* export_names,
776 ZoneList<Scanner::Location>* export_locations, 773 ZoneList<Scanner::Location>* export_locations,
777 ZoneList<const AstRawString*>* local_names, 774 ZoneList<const AstRawString*>* local_names,
778 Scanner::Location* reserved_loc, bool* ok); 775 Scanner::Location* reserved_loc, bool* ok);
779 struct NamedImport : public ZoneObject { 776 struct NamedImport : public ZoneObject {
780 const AstRawString* import_name; 777 const AstRawString* import_name;
781 const AstRawString* local_name; 778 const AstRawString* local_name;
782 const Scanner::Location location; 779 const Scanner::Location location;
783 NamedImport(const AstRawString* import_name, const AstRawString* local_name, 780 NamedImport(const AstRawString* import_name, const AstRawString* local_name,
784 Scanner::Location location) 781 Scanner::Location location)
785 : import_name(import_name), 782 : import_name(import_name),
786 local_name(local_name), 783 local_name(local_name),
787 location(location) {} 784 location(location) {}
788 }; 785 };
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3 1030 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3
1034 void InsertSloppyBlockFunctionVarBindings(Scope* scope, 1031 void InsertSloppyBlockFunctionVarBindings(Scope* scope,
1035 Scope* complex_params_scope, 1032 Scope* complex_params_scope,
1036 bool* ok); 1033 bool* ok);
1037 1034
1038 // Parser support 1035 // Parser support
1039 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); 1036 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
1040 Variable* Declare(Declaration* declaration, 1037 Variable* Declare(Declaration* declaration,
1041 DeclarationDescriptor::Kind declaration_kind, bool resolve, 1038 DeclarationDescriptor::Kind declaration_kind, bool resolve,
1042 bool* ok, Scope* declaration_scope = nullptr); 1039 bool* ok, Scope* declaration_scope = nullptr);
1043 void* DeclareImport(const AstRawString* local_name, int pos, bool* ok); 1040 void DeclareImport(const AstRawString* local_name, int pos, bool* ok);
1044 1041
1045 bool TargetStackContainsLabel(const AstRawString* label); 1042 bool TargetStackContainsLabel(const AstRawString* label);
1046 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1043 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1047 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1044 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1048 1045
1049 Statement* BuildAssertIsCoercible(Variable* var); 1046 Statement* BuildAssertIsCoercible(Variable* var);
1050 1047
1051 // Factory methods. 1048 // Factory methods.
1052 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, 1049 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
1053 Scope* scope, int pos, int end_pos, 1050 Scope* scope, int pos, int end_pos,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1311
1315 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1312 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1316 return parser_->ParseDoExpression(ok); 1313 return parser_->ParseDoExpression(ok);
1317 } 1314 }
1318 1315
1319 1316
1320 } // namespace internal 1317 } // namespace internal
1321 } // namespace v8 1318 } // namespace v8
1322 1319
1323 #endif // V8_PARSING_PARSER_H_ 1320 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698