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

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

Issue 2108193003: [modules] AST and parser rework. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@anonymous-declarations
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
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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 758
759 // All ParseXXX functions take as the last argument an *ok parameter 759 // All ParseXXX functions take as the last argument an *ok parameter
760 // which is set to false if parsing failed; it is unchanged otherwise. 760 // which is set to false if parsing failed; it is unchanged otherwise.
761 // By making the 'exception handling' explicit, we are forced to check 761 // By making the 'exception handling' explicit, we are forced to check
762 // for failure at the call sites. 762 // for failure at the call sites.
763 void* ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok); 763 void* ParseStatementList(ZoneList<Statement*>* body, int end_token, bool* ok);
764 Statement* ParseStatementListItem(bool* ok); 764 Statement* ParseStatementListItem(bool* ok);
765 void* ParseModuleItemList(ZoneList<Statement*>* body, bool* ok); 765 void* ParseModuleItemList(ZoneList<Statement*>* body, bool* ok);
766 Statement* ParseModuleItem(bool* ok); 766 Statement* ParseModuleItem(bool* ok);
767 const AstRawString* ParseModuleSpecifier(bool* ok); 767 const AstRawString* ParseModuleSpecifier(bool* ok);
768 Statement* ParseImportDeclaration(bool* ok); 768 void* ParseImportDeclaration(bool* ok);
769 Statement* ParseExportDeclaration(bool* ok); 769 Statement* ParseExportDeclaration(bool* ok);
770 Statement* ParseExportDefault(bool* ok); 770 Statement* ParseExportDefault(bool* ok);
771 void* ParseExportClause(ZoneList<const AstRawString*>* export_names, 771 void* ParseExportClause(ZoneList<const AstRawString*>* export_names,
772 ZoneList<Scanner::Location>* export_locations, 772 ZoneList<Scanner::Location>* export_locations,
773 ZoneList<const AstRawString*>* local_names, 773 ZoneList<const AstRawString*>* local_names,
774 Scanner::Location* reserved_loc, bool* ok); 774 Scanner::Location* reserved_loc, bool* ok);
775 ZoneList<ImportDeclaration*>* ParseNamedImports(int pos, bool* ok); 775 struct NamedImport {
776 const AstRawString* import_name;
777 const AstRawString* local_name;
778 const Scanner::Location location;
779 NamedImport(const AstRawString* import_name, const AstRawString* local_name,
780 const Scanner::Location location)
adamk 2016/07/13 18:38:22 No need for "const" here.
neis 2016/07/14 10:28:24 Done.
781 : import_name(import_name),
782 local_name(local_name),
783 location(location) {}
784 };
785 ZoneList<const NamedImport*>* ParseNamedImports(int pos, bool* ok);
776 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, 786 Statement* ParseStatement(ZoneList<const AstRawString*>* labels,
777 AllowLabelledFunctionStatement allow_function, 787 AllowLabelledFunctionStatement allow_function,
778 bool* ok); 788 bool* ok);
779 Statement* ParseSubStatement(ZoneList<const AstRawString*>* labels, 789 Statement* ParseSubStatement(ZoneList<const AstRawString*>* labels,
780 AllowLabelledFunctionStatement allow_function, 790 AllowLabelledFunctionStatement allow_function,
781 bool* ok); 791 bool* ok);
782 Statement* ParseStatementAsUnlabelled(ZoneList<const AstRawString*>* labels, 792 Statement* ParseStatementAsUnlabelled(ZoneList<const AstRawString*>* labels,
783 bool* ok); 793 bool* ok);
784 Statement* ParseFunctionDeclaration(bool* ok); 794 Statement* ParseFunctionDeclaration(bool* ok);
785 Statement* ParseHoistableDeclaration(ZoneList<const AstRawString*>* names, 795 Statement* ParseHoistableDeclaration(ZoneList<const AstRawString*>* names,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3 1028 // Implement sloppy block-scoped functions, ES2015 Annex B 3.3
1019 void InsertSloppyBlockFunctionVarBindings(Scope* scope, 1029 void InsertSloppyBlockFunctionVarBindings(Scope* scope,
1020 Scope* complex_params_scope, 1030 Scope* complex_params_scope,
1021 bool* ok); 1031 bool* ok);
1022 1032
1023 // Parser support 1033 // Parser support
1024 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); 1034 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
1025 Variable* Declare(Declaration* declaration, 1035 Variable* Declare(Declaration* declaration,
1026 DeclarationDescriptor::Kind declaration_kind, bool resolve, 1036 DeclarationDescriptor::Kind declaration_kind, bool resolve,
1027 bool* ok, Scope* declaration_scope = nullptr); 1037 bool* ok, Scope* declaration_scope = nullptr);
1038 void* DeclareImport(const AstRawString* local_name, int pos, bool* ok);
1028 1039
1029 bool TargetStackContainsLabel(const AstRawString* label); 1040 bool TargetStackContainsLabel(const AstRawString* label);
1030 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1041 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1031 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1042 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1032 1043
1033 Statement* BuildAssertIsCoercible(Variable* var); 1044 Statement* BuildAssertIsCoercible(Variable* var);
1034 1045
1035 // Factory methods. 1046 // Factory methods.
1036 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, 1047 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
1037 Scope* scope, int pos, int end_pos, 1048 Scope* scope, int pos, int end_pos,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 1309
1299 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1310 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1300 return parser_->ParseDoExpression(ok); 1311 return parser_->ParseDoExpression(ok);
1301 } 1312 }
1302 1313
1303 1314
1304 } // namespace internal 1315 } // namespace internal
1305 } // namespace v8 1316 } // namespace v8
1306 1317
1307 #endif // V8_PARSING_PARSER_H_ 1318 #endif // V8_PARSING_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698