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

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: Rebase on top of rest+arrow functions Created 5 years, 6 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( 830 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadArguments(
831 ZoneList<v8::internal::Expression*>* list); 831 ZoneList<v8::internal::Expression*>* list);
832 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} 832 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {}
833 V8_INLINE Expression* SpreadCall(Expression* function, 833 V8_INLINE Expression* SpreadCall(Expression* function,
834 ZoneList<v8::internal::Expression*>* args, 834 ZoneList<v8::internal::Expression*>* args,
835 int pos); 835 int pos);
836 V8_INLINE Expression* SpreadCallNew(Expression* function, 836 V8_INLINE Expression* SpreadCallNew(Expression* function,
837 ZoneList<v8::internal::Expression*>* args, 837 ZoneList<v8::internal::Expression*>* args,
838 int pos); 838 int pos);
839 839
840 inline Expression* RewriteDestructuringAssignment(Expression* expr, bool* ok);
841
840 private: 842 private:
841 Parser* parser_; 843 Parser* parser_;
842 }; 844 };
843 845
844 846
845 class Parser : public ParserBase<ParserTraits> { 847 class Parser : public ParserBase<ParserTraits> {
846 public: 848 public:
847 explicit Parser(ParseInfo* info); 849 explicit Parser(ParseInfo* info);
848 ~Parser() { 850 ~Parser() {
849 delete reusable_preparser_; 851 delete reusable_preparser_;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 // Initialize the components of a for-in / for-of statement. 1059 // Initialize the components of a for-in / for-of statement.
1058 void InitializeForEachStatement(ForEachStatement* stmt, 1060 void InitializeForEachStatement(ForEachStatement* stmt,
1059 Expression* each, 1061 Expression* each,
1060 Expression* subject, 1062 Expression* subject,
1061 Statement* body); 1063 Statement* body);
1062 Statement* DesugarLexicalBindingsInForStatement( 1064 Statement* DesugarLexicalBindingsInForStatement(
1063 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, 1065 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names,
1064 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 1066 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
1065 Statement* body, bool* ok); 1067 Statement* body, bool* ok);
1066 1068
1069 Expression* DesugarDestructuringAssignment(Expression* expr, bool* ok);
1070
1067 FunctionLiteral* ParseFunctionLiteral( 1071 FunctionLiteral* ParseFunctionLiteral(
1068 const AstRawString* name, Scanner::Location function_name_location, 1072 const AstRawString* name, Scanner::Location function_name_location,
1069 bool name_is_strict_reserved, FunctionKind kind, 1073 bool name_is_strict_reserved, FunctionKind kind,
1070 int function_token_position, FunctionLiteral::FunctionType type, 1074 int function_token_position, FunctionLiteral::FunctionType type,
1071 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); 1075 FunctionLiteral::ArityRestriction arity_restriction, bool* ok);
1072 1076
1073 1077
1074 ClassLiteral* ParseClassLiteral(const AstRawString* name, 1078 ClassLiteral* ParseClassLiteral(const AstRawString* name,
1075 Scanner::Location class_name_location, 1079 Scanner::Location class_name_location,
1076 bool name_is_strict_reserved, int pos, 1080 bool name_is_strict_reserved, int pos,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 // TODO(sigurds) Mark every parameter as maybe assigned. This is a 1284 // TODO(sigurds) Mark every parameter as maybe assigned. This is a
1281 // conservative approximation necessary to account for parameters 1285 // conservative approximation necessary to account for parameters
1282 // that are assigned via the arguments array. 1286 // that are assigned via the arguments array.
1283 var->set_maybe_assigned(); 1287 var->set_maybe_assigned();
1284 } 1288 }
1285 if (is_duplicate) { 1289 if (is_duplicate) {
1286 classifier->RecordDuplicateFormalParameterError( 1290 classifier->RecordDuplicateFormalParameterError(
1287 parser_->scanner()->location()); 1291 parser_->scanner()->location());
1288 } 1292 }
1289 } 1293 }
1294
1295
1296 inline Expression* ParserTraits::RewriteDestructuringAssignment(
1297 Expression* expr, bool* ok) {
1298 return parser_->DesugarDestructuringAssignment(expr, ok);
1299 }
1290 } } // namespace v8::internal 1300 } } // namespace v8::internal
1291 1301
1292 #endif // V8_PARSER_H_ 1302 #endif // V8_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698