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/preparser.h

Issue 2372733002: [parser] Refactor of (Parse|Desugar)*(Async|Arrow)* (Closed)
Patch Set: Rebase Created 4 years, 2 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/parsing/parser-base.h ('k') | src/parsing/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_PARSING_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parser-base.h" 9 #include "src/parsing/parser-base.h"
10 10
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // These types form an algebra over syntactic categories that is just 831 // These types form an algebra over syntactic categories that is just
832 // rich enough to let us recognize and propagate the constructs that 832 // rich enough to let us recognize and propagate the constructs that
833 // are either being counted in the preparser data, or is important 833 // are either being counted in the preparser data, or is important
834 // to throw the correct syntax error exceptions. 834 // to throw the correct syntax error exceptions.
835 835
836 // All ParseXXX functions take as the last argument an *ok parameter 836 // All ParseXXX functions take as the last argument an *ok parameter
837 // which is set to false if parsing failed; it is unchanged otherwise. 837 // which is set to false if parsing failed; it is unchanged otherwise.
838 // By making the 'exception handling' explicit, we are forced to check 838 // By making the 'exception handling' explicit, we are forced to check
839 // for failure at the call sites. 839 // for failure at the call sites.
840 Statement ParseFunctionDeclaration(bool* ok); 840 Statement ParseFunctionDeclaration(bool* ok);
841 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
842 bool default_export, bool* ok);
843 Expression ParseAsyncFunctionExpression(bool* ok);
844 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, 841 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names,
845 bool default_export, bool* ok); 842 bool default_export, bool* ok);
846 Expression ParseConditionalExpression(bool accept_IN, bool* ok); 843 Expression ParseConditionalExpression(bool accept_IN, bool* ok);
847 Expression ParseObjectLiteral(bool* ok); 844 Expression ParseObjectLiteral(bool* ok);
848 845
849 V8_INLINE PreParserStatementList ParseEagerFunctionBody( 846 V8_INLINE PreParserStatementList ParseEagerFunctionBody(
850 PreParserIdentifier function_name, int pos, 847 PreParserIdentifier function_name, int pos,
851 const PreParserFormalParameters& parameters, FunctionKind kind, 848 const PreParserFormalParameters& parameters, FunctionKind kind,
852 FunctionLiteral::FunctionType function_type, bool* ok); 849 FunctionLiteral::FunctionType function_type, bool* ok);
853 850
(...skipping 28 matching lines...) Expand all
882 V8_INLINE void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} 879 V8_INLINE void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {}
883 880
884 V8_INLINE void SetLanguageMode(Scope* scope, LanguageMode mode) { 881 V8_INLINE void SetLanguageMode(Scope* scope, LanguageMode mode) {
885 scope->SetLanguageMode(mode); 882 scope->SetLanguageMode(mode);
886 } 883 }
887 V8_INLINE void SetAsmModule() {} 884 V8_INLINE void SetAsmModule() {}
888 885
889 V8_INLINE void MarkCollectedTailCallExpressions() {} 886 V8_INLINE void MarkCollectedTailCallExpressions() {}
890 V8_INLINE void MarkTailPosition(PreParserExpression expression) {} 887 V8_INLINE void MarkTailPosition(PreParserExpression expression) {}
891 888
892 void ParseAsyncArrowSingleExpressionBody(PreParserStatementList body,
893 bool accept_IN,
894 int pos, bool* ok);
895
896 V8_INLINE PreParserExpressionList 889 V8_INLINE PreParserExpressionList
897 PrepareSpreadArguments(PreParserExpressionList list) { 890 PrepareSpreadArguments(PreParserExpressionList list) {
898 return list; 891 return list;
899 } 892 }
900 893
901 V8_INLINE PreParserExpression SpreadCall(PreParserExpression function, 894 V8_INLINE PreParserExpression SpreadCall(PreParserExpression function,
902 PreParserExpressionList args, 895 PreParserExpressionList args,
903 int pos); 896 int pos);
904 V8_INLINE PreParserExpression SpreadCallNew(PreParserExpression function, 897 V8_INLINE PreParserExpression SpreadCallNew(PreParserExpression function,
905 PreParserExpressionList args, 898 PreParserExpressionList args,
(...skipping 13 matching lines...) Expand all
919 } 912 }
920 V8_INLINE PreParserExpression RewriteAssignExponentiation( 913 V8_INLINE PreParserExpression RewriteAssignExponentiation(
921 PreParserExpression left, PreParserExpression right, int pos) { 914 PreParserExpression left, PreParserExpression right, int pos) {
922 return left; 915 return left;
923 } 916 }
924 917
925 V8_INLINE PreParserExpression 918 V8_INLINE PreParserExpression
926 RewriteAwaitExpression(PreParserExpression value, int pos) { 919 RewriteAwaitExpression(PreParserExpression value, int pos) {
927 return value; 920 return value;
928 } 921 }
922 V8_INLINE void PrepareAsyncFunctionBody(PreParserStatementList body,
923 FunctionKind kind, int pos) {}
924 V8_INLINE void RewriteAsyncFunctionBody(PreParserStatementList body,
925 PreParserStatement block,
926 PreParserExpression return_value,
927 bool* ok) {}
929 V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator, 928 V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator,
930 PreParserExpression expression, 929 PreParserExpression expression,
931 int pos) { 930 int pos) {
932 return PreParserExpression::Default(); 931 return PreParserExpression::Default();
933 } 932 }
934 V8_INLINE void RewriteNonPattern(bool* ok) { ValidateExpression(ok); } 933 V8_INLINE void RewriteNonPattern(bool* ok) { ValidateExpression(ok); }
935 934
936 V8_INLINE void DeclareAndInitializeVariables( 935 V8_INLINE void DeclareAndInitializeVariables(
937 PreParserStatement block, 936 PreParserStatement block,
938 const DeclarationDescriptor* declaration_descriptor, 937 const DeclarationDescriptor* declaration_descriptor,
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 ++parameters->arity; 1354 ++parameters->arity;
1356 } 1355 }
1357 1356
1358 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope, 1357 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope,
1359 PreParserIdentifier parameter) { 1358 PreParserIdentifier parameter) {
1360 if (!classifier()->is_simple_parameter_list()) { 1359 if (!classifier()->is_simple_parameter_list()) {
1361 scope->SetHasNonSimpleParameters(); 1360 scope->SetHasNonSimpleParameters();
1362 } 1361 }
1363 } 1362 }
1364 1363
1365 V8_INLINE void ParseArrowFunctionFormalParameterList( 1364 V8_INLINE void DeclareArrowFunctionFormalParameters(
1366 PreParserFormalParameters* parameters, PreParserExpression params, 1365 PreParserFormalParameters* parameters, PreParserExpression params,
1367 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, 1366 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
1368 const Scope::Snapshot& scope_snapshot, bool* ok) { 1367 bool* ok) {
1369 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect 1368 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect
1370 // parameter 1369 // parameter lists that are too long.
1371 // lists that are too long.
1372 } 1370 }
1373 1371
1374 V8_INLINE void ReindexLiterals(const PreParserFormalParameters& parameters) {} 1372 V8_INLINE void ReindexLiterals(const PreParserFormalParameters& parameters) {}
1375 1373
1376 V8_INLINE PreParserExpression NoTemplateTag() { 1374 V8_INLINE PreParserExpression NoTemplateTag() {
1377 return PreParserExpression::NoTemplateTag(); 1375 return PreParserExpression::NoTemplateTag();
1378 } 1376 }
1379 1377
1380 V8_INLINE static bool IsTaggedTemplate(const PreParserExpression tag) { 1378 V8_INLINE static bool IsTaggedTemplate(const PreParserExpression tag) {
1381 return !tag.IsNoTemplateTag(); 1379 return !tag.IsNoTemplateTag();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 function_state_->NextMaterializedLiteralIndex(); 1458 function_state_->NextMaterializedLiteralIndex();
1461 function_state_->NextMaterializedLiteralIndex(); 1459 function_state_->NextMaterializedLiteralIndex();
1462 } 1460 }
1463 return EmptyExpression(); 1461 return EmptyExpression();
1464 } 1462 }
1465 1463
1466 } // namespace internal 1464 } // namespace internal
1467 } // namespace v8 1465 } // namespace v8
1468 1466
1469 #endif // V8_PARSING_PREPARSER_H 1467 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698