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

Side by Side Diff: src/parser.h

Issue 1168643005: [es6] parse destructuring assignment (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP #1 Created 5 years, 4 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.h ('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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 bool is_simple, ExpressionClassifier* classifier); 789 bool is_simple, ExpressionClassifier* classifier);
790 void ParseArrowFunctionFormalParameters( 790 void ParseArrowFunctionFormalParameters(
791 ParserFormalParameters* parameters, Expression* params, 791 ParserFormalParameters* parameters, Expression* params,
792 const Scanner::Location& params_loc, 792 const Scanner::Location& params_loc,
793 Scanner::Location* duplicate_loc, bool* ok); 793 Scanner::Location* duplicate_loc, 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 Expression* RewriteDestructuringAssignment(Expression* expression);
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 // Initialize the components of a for-in / for-of statement. 1098 // Initialize the components of a for-in / for-of statement.
1097 void InitializeForEachStatement(ForEachStatement* stmt, 1099 void InitializeForEachStatement(ForEachStatement* stmt,
1098 Expression* each, 1100 Expression* each,
1099 Expression* subject, 1101 Expression* subject,
1100 Statement* body); 1102 Statement* body);
1101 Statement* DesugarLexicalBindingsInForStatement( 1103 Statement* DesugarLexicalBindingsInForStatement(
1102 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, 1104 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names,
1103 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 1105 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
1104 Statement* body, bool* ok); 1106 Statement* body, bool* ok);
1105 1107
1108 Expression* DesugarDestructuringAssignment(Expression* expr);
1109
1106 FunctionLiteral* ParseFunctionLiteral( 1110 FunctionLiteral* ParseFunctionLiteral(
1107 const AstRawString* name, Scanner::Location function_name_location, 1111 const AstRawString* name, Scanner::Location function_name_location,
1108 FunctionNameValidity function_name_validity, FunctionKind kind, 1112 FunctionNameValidity function_name_validity, FunctionKind kind,
1109 int function_token_position, FunctionLiteral::FunctionType type, 1113 int function_token_position, FunctionLiteral::FunctionType type,
1110 FunctionLiteral::ArityRestriction arity_restriction, 1114 FunctionLiteral::ArityRestriction arity_restriction,
1111 LanguageMode language_mode, bool* ok); 1115 LanguageMode language_mode, bool* ok);
1112 1116
1113 1117
1114 ClassLiteral* ParseClassLiteral(const AstRawString* name, 1118 ClassLiteral* ParseClassLiteral(const AstRawString* name,
1115 Scanner::Location class_name_location, 1119 Scanner::Location class_name_location,
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 ZoneList<v8::internal::Statement*>* body, bool* ok) { 1364 ZoneList<v8::internal::Statement*>* body, bool* ok) {
1361 if (!parameters.is_simple) { 1365 if (!parameters.is_simple) {
1362 auto* init_block = 1366 auto* init_block =
1363 parser_->BuildParameterInitializationBlock(parameters, ok); 1367 parser_->BuildParameterInitializationBlock(parameters, ok);
1364 if (!*ok) return; 1368 if (!*ok) return;
1365 if (init_block != nullptr) { 1369 if (init_block != nullptr) {
1366 body->Add(init_block, parser_->zone()); 1370 body->Add(init_block, parser_->zone());
1367 } 1371 }
1368 } 1372 }
1369 } 1373 }
1374
1375
1376 inline Expression* ParserTraits::RewriteDestructuringAssignment(
1377 Expression* expr) {
1378 return parser_->DesugarDestructuringAssignment(expr);
1379 }
1370 } } // namespace v8::internal 1380 } } // namespace v8::internal
1371 1381
1372 #endif // V8_PARSER_H_ 1382 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698