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

Side by Side Diff: src/parser.h

Issue 1078093002: Factor formal argument parsing into ParserBase (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Rebase on top of "undefined" error detection, remove bits of utils.h patch that crept in Created 5 years, 8 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/messages.js ('k') | src/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_PARSER_H_ 5 #ifndef V8_PARSER_H_
6 #define V8_PARSER_H_ 6 #define V8_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // Return types for traversing functions. 550 // Return types for traversing functions.
551 typedef const AstRawString* Identifier; 551 typedef const AstRawString* Identifier;
552 typedef v8::internal::Expression* Expression; 552 typedef v8::internal::Expression* Expression;
553 typedef Yield* YieldExpression; 553 typedef Yield* YieldExpression;
554 typedef v8::internal::FunctionLiteral* FunctionLiteral; 554 typedef v8::internal::FunctionLiteral* FunctionLiteral;
555 typedef v8::internal::ClassLiteral* ClassLiteral; 555 typedef v8::internal::ClassLiteral* ClassLiteral;
556 typedef v8::internal::Literal* Literal; 556 typedef v8::internal::Literal* Literal;
557 typedef ObjectLiteral::Property* ObjectLiteralProperty; 557 typedef ObjectLiteral::Property* ObjectLiteralProperty;
558 typedef ZoneList<v8::internal::Expression*>* ExpressionList; 558 typedef ZoneList<v8::internal::Expression*>* ExpressionList;
559 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; 559 typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
560 typedef const v8::internal::AstRawString* FormalParameter;
561 typedef ZoneList<const v8::internal::AstRawString*>* FormalParameterList;
560 typedef ZoneList<v8::internal::Statement*>* StatementList; 562 typedef ZoneList<v8::internal::Statement*>* StatementList;
561 563
562 // For constructing objects returned by the traversing functions. 564 // For constructing objects returned by the traversing functions.
563 typedef AstNodeFactory Factory; 565 typedef AstNodeFactory Factory;
564 }; 566 };
565 567
566 explicit ParserTraits(Parser* parser) : parser_(parser) {} 568 explicit ParserTraits(Parser* parser) : parser_(parser) {}
567 569
568 // Helper functions for recursive descent. 570 // Helper functions for recursive descent.
569 bool IsEval(const AstRawString* identifier) const; 571 bool IsEval(const AstRawString* identifier) const;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 static Literal* EmptyLiteral() { 700 static Literal* EmptyLiteral() {
699 return NULL; 701 return NULL;
700 } 702 }
701 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } 703 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; }
702 static FunctionLiteral* EmptyFunctionLiteral() { return NULL; } 704 static FunctionLiteral* EmptyFunctionLiteral() { return NULL; }
703 705
704 // Used in error return values. 706 // Used in error return values.
705 static ZoneList<Expression*>* NullExpressionList() { 707 static ZoneList<Expression*>* NullExpressionList() {
706 return NULL; 708 return NULL;
707 } 709 }
710 static const AstRawString* EmptyFormalParameter() { return NULL; }
711 static ZoneList<const AstRawString*>* NullFormalParameterList() {
712 return NULL;
713 }
708 714
709 // Non-NULL empty string. 715 // Non-NULL empty string.
710 V8_INLINE const AstRawString* EmptyIdentifierString(); 716 V8_INLINE const AstRawString* EmptyIdentifierString();
711 717
712 // Odd-ball literal creators. 718 // Odd-ball literal creators.
713 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory); 719 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory);
714 720
715 // Producing data during the recursive descent. 721 // Producing data during the recursive descent.
716 const AstRawString* GetSymbol(Scanner* scanner); 722 const AstRawString* GetSymbol(Scanner* scanner);
717 const AstRawString* GetNextSymbol(Scanner* scanner); 723 const AstRawString* GetNextSymbol(Scanner* scanner);
(...skipping 15 matching lines...) Expand all
733 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); 739 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory);
734 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { 740 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) {
735 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); 741 return new(zone) ZoneList<v8::internal::Expression*>(size, zone);
736 } 742 }
737 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { 743 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) {
738 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); 744 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone);
739 } 745 }
740 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { 746 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) {
741 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); 747 return new(zone) ZoneList<v8::internal::Statement*>(size, zone);
742 } 748 }
749 ZoneList<const v8::internal::AstRawString*>* NewFormalParameterList(
750 int size, Zone* zone) {
751 return new (zone) ZoneList<const v8::internal::AstRawString*>(size, zone);
752 }
743 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, 753 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type,
744 FunctionKind kind = kNormalFunction); 754 FunctionKind kind = kNormalFunction);
745 755
746 // Utility functions 756 // Utility functions
747 int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope, 757 int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope,
748 Scanner::Location* undefined_loc, 758 Scanner::Location* undefined_loc,
749 Scanner::Location* dupe_loc, 759 Scanner::Location* dupe_loc,
750 bool* ok); 760 bool* ok);
751 761
752 // Temporary glue; these functions will move to ParserBase. 762 // Temporary glue; these functions will move to ParserBase.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 } 1171 }
1162 1172
1163 1173
1164 Expression* ParserTraits::SpreadCallNew( 1174 Expression* ParserTraits::SpreadCallNew(
1165 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { 1175 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) {
1166 return parser_->SpreadCallNew(function, args, pos); 1176 return parser_->SpreadCallNew(function, args, pos);
1167 } 1177 }
1168 } } // namespace v8::internal 1178 } } // namespace v8::internal
1169 1179
1170 #endif // V8_PARSER_H_ 1180 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698