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

Side by Side Diff: src/parser.h

Issue 1399893002: [es7] implement |do| expressions proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable CrankShaft Created 5 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
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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 ExpressionClassifier* classifier); 789 ExpressionClassifier* classifier);
790 void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters, 790 void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters,
791 Expression* params, 791 Expression* params,
792 const Scanner::Location& params_loc, 792 const Scanner::Location& params_loc,
793 bool* ok); 793 bool* ok);
794 void ParseArrowFunctionFormalParameterList( 794 void ParseArrowFunctionFormalParameterList(
795 ParserFormalParameters* parameters, Expression* params, 795 ParserFormalParameters* parameters, Expression* params,
796 const Scanner::Location& params_loc, 796 const Scanner::Location& params_loc,
797 Scanner::Location* duplicate_loc, bool* ok); 797 Scanner::Location* duplicate_loc, bool* ok);
798 798
799 V8_INLINE DoExpression* ParseDoExpression(bool* ok);
800
799 void ReindexLiterals(const ParserFormalParameters& parameters); 801 void ReindexLiterals(const ParserFormalParameters& parameters);
800 802
801 // Temporary glue; these functions will move to ParserBase. 803 // Temporary glue; these functions will move to ParserBase.
802 Expression* ParseV8Intrinsic(bool* ok); 804 Expression* ParseV8Intrinsic(bool* ok);
803 FunctionLiteral* ParseFunctionLiteral( 805 FunctionLiteral* ParseFunctionLiteral(
804 const AstRawString* name, Scanner::Location function_name_location, 806 const AstRawString* name, Scanner::Location function_name_location,
805 FunctionNameValidity function_name_validity, FunctionKind kind, 807 FunctionNameValidity function_name_validity, FunctionKind kind,
806 int function_token_position, FunctionLiteral::FunctionType type, 808 int function_token_position, FunctionLiteral::FunctionType type,
807 FunctionLiteral::ArityRestriction arity_restriction, 809 FunctionLiteral::ArityRestriction arity_restriction,
808 LanguageMode language_mode, bool* ok); 810 LanguageMode language_mode, bool* ok);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 bool* ok); 966 bool* ok);
965 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, 967 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names,
966 bool* ok); 968 bool* ok);
967 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names, 969 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names,
968 bool* ok); 970 bool* ok);
969 Statement* ParseNativeDeclaration(bool* ok); 971 Statement* ParseNativeDeclaration(bool* ok);
970 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); 972 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok);
971 Block* ParseVariableStatement(VariableDeclarationContext var_context, 973 Block* ParseVariableStatement(VariableDeclarationContext var_context,
972 ZoneList<const AstRawString*>* names, 974 ZoneList<const AstRawString*>* names,
973 bool* ok); 975 bool* ok);
976 DoExpression* ParseDoExpression(bool* ok);
974 977
975 struct DeclarationDescriptor { 978 struct DeclarationDescriptor {
976 enum Kind { NORMAL, PARAMETER }; 979 enum Kind { NORMAL, PARAMETER };
977 Parser* parser; 980 Parser* parser;
978 Scope* declaration_scope; 981 Scope* declaration_scope;
979 Scope* scope; 982 Scope* scope;
980 Scope* hoist_scope; 983 Scope* hoist_scope;
981 VariableMode mode; 984 VariableMode mode;
982 bool is_const; 985 bool is_const;
983 bool needs_init; 986 bool needs_init;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 // Initialize the components of a for-in / for-of statement. 1100 // Initialize the components of a for-in / for-of statement.
1098 void InitializeForEachStatement(ForEachStatement* stmt, 1101 void InitializeForEachStatement(ForEachStatement* stmt,
1099 Expression* each, 1102 Expression* each,
1100 Expression* subject, 1103 Expression* subject,
1101 Statement* body); 1104 Statement* body);
1102 Statement* DesugarLexicalBindingsInForStatement( 1105 Statement* DesugarLexicalBindingsInForStatement(
1103 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, 1106 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names,
1104 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 1107 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
1105 Statement* body, bool* ok); 1108 Statement* body, bool* ok);
1106 1109
1110 void RewriteDoExpression(Expression* expr, bool* ok);
1111
1107 FunctionLiteral* ParseFunctionLiteral( 1112 FunctionLiteral* ParseFunctionLiteral(
1108 const AstRawString* name, Scanner::Location function_name_location, 1113 const AstRawString* name, Scanner::Location function_name_location,
1109 FunctionNameValidity function_name_validity, FunctionKind kind, 1114 FunctionNameValidity function_name_validity, FunctionKind kind,
1110 int function_token_position, FunctionLiteral::FunctionType type, 1115 int function_token_position, FunctionLiteral::FunctionType type,
1111 FunctionLiteral::ArityRestriction arity_restriction, 1116 FunctionLiteral::ArityRestriction arity_restriction,
1112 LanguageMode language_mode, bool* ok); 1117 LanguageMode language_mode, bool* ok);
1113 1118
1114 1119
1115 ClassLiteral* ParseClassLiteral(const AstRawString* name, 1120 ClassLiteral* ParseClassLiteral(const AstRawString* name,
1116 Scanner::Location class_name_location, 1121 Scanner::Location class_name_location,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1246 }
1242 1247
1243 1248
1244 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( 1249 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody(
1245 const AstRawString* name, int pos, const ParserFormalParameters& parameters, 1250 const AstRawString* name, int pos, const ParserFormalParameters& parameters,
1246 FunctionKind kind, FunctionLiteral::FunctionType function_type, bool* ok) { 1251 FunctionKind kind, FunctionLiteral::FunctionType function_type, bool* ok) {
1247 return parser_->ParseEagerFunctionBody(name, pos, parameters, kind, 1252 return parser_->ParseEagerFunctionBody(name, pos, parameters, kind,
1248 function_type, ok); 1253 function_type, ok);
1249 } 1254 }
1250 1255
1256
1251 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope, 1257 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope,
1252 bool* ok) { 1258 bool* ok) {
1253 parser_->CheckConflictingVarDeclarations(scope, ok); 1259 parser_->CheckConflictingVarDeclarations(scope, ok);
1254 } 1260 }
1255 1261
1256 1262
1257 // Support for handling complex values (array and object literals) that 1263 // Support for handling complex values (array and object literals) that
1258 // can be fully handled at compile time. 1264 // can be fully handled at compile time.
1259 class CompileTimeValue: public AllStatic { 1265 class CompileTimeValue: public AllStatic {
1260 public: 1266 public:
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 ZoneList<v8::internal::Statement*>* body, bool* ok) { 1376 ZoneList<v8::internal::Statement*>* body, bool* ok) {
1371 if (!parameters.is_simple) { 1377 if (!parameters.is_simple) {
1372 auto* init_block = 1378 auto* init_block =
1373 parser_->BuildParameterInitializationBlock(parameters, ok); 1379 parser_->BuildParameterInitializationBlock(parameters, ok);
1374 if (!*ok) return; 1380 if (!*ok) return;
1375 if (init_block != nullptr) { 1381 if (init_block != nullptr) {
1376 body->Add(init_block, parser_->zone()); 1382 body->Add(init_block, parser_->zone());
1377 } 1383 }
1378 } 1384 }
1379 } 1385 }
1386
1387
1388 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1389 return parser_->ParseDoExpression(ok);
1390 }
1391
1392
1380 } // namespace internal 1393 } // namespace internal
1381 } // namespace v8 1394 } // namespace v8
1382 1395
1383 #endif // V8_PARSER_H_ 1396 #endif // V8_PARSER_H_
OLDNEW
« src/ast.h ('K') | « src/interpreter/bytecode-generator.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698