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

Side by Side Diff: src/ast.h

Issue 332663004: For-of calls [Symbol.iterator]() on RHS to get iterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/array-iterator.js ('k') | src/bootstrapper.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_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 }; 949 };
950 950
951 951
952 class ForOfStatement V8_FINAL : public ForEachStatement { 952 class ForOfStatement V8_FINAL : public ForEachStatement {
953 public: 953 public:
954 DECLARE_NODE_TYPE(ForOfStatement) 954 DECLARE_NODE_TYPE(ForOfStatement)
955 955
956 void Initialize(Expression* each, 956 void Initialize(Expression* each,
957 Expression* subject, 957 Expression* subject,
958 Statement* body, 958 Statement* body,
959 Expression* assign_iterable,
959 Expression* assign_iterator, 960 Expression* assign_iterator,
960 Expression* next_result, 961 Expression* next_result,
961 Expression* result_done, 962 Expression* result_done,
962 Expression* assign_each) { 963 Expression* assign_each) {
963 ForEachStatement::Initialize(each, subject, body); 964 ForEachStatement::Initialize(each, subject, body);
965 assign_iterable_ = assign_iterable;
964 assign_iterator_ = assign_iterator; 966 assign_iterator_ = assign_iterator;
965 next_result_ = next_result; 967 next_result_ = next_result;
966 result_done_ = result_done; 968 result_done_ = result_done;
967 assign_each_ = assign_each; 969 assign_each_ = assign_each;
968 } 970 }
969 971
970 Expression* iterable() const { 972 Expression* iterable() const {
971 return subject(); 973 return subject();
972 } 974 }
973 975
974 // var iterator = iterable; 976 // var iterable = subject;
977 Expression* assign_iterable() const {
978 return assign_iterable_;
979 }
980
981 // var iterator = iterable[Symbol.iterator]();
975 Expression* assign_iterator() const { 982 Expression* assign_iterator() const {
976 return assign_iterator_; 983 return assign_iterator_;
977 } 984 }
978 985
979 // var result = iterator.next(); 986 // var result = iterator.next();
980 Expression* next_result() const { 987 Expression* next_result() const {
981 return next_result_; 988 return next_result_;
982 } 989 }
983 990
984 // result.done 991 // result.done
(...skipping 14 matching lines...) Expand all
999 protected: 1006 protected:
1000 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos) 1007 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos)
1001 : ForEachStatement(zone, labels, pos), 1008 : ForEachStatement(zone, labels, pos),
1002 assign_iterator_(NULL), 1009 assign_iterator_(NULL),
1003 next_result_(NULL), 1010 next_result_(NULL),
1004 result_done_(NULL), 1011 result_done_(NULL),
1005 assign_each_(NULL), 1012 assign_each_(NULL),
1006 back_edge_id_(GetNextId(zone)) { 1013 back_edge_id_(GetNextId(zone)) {
1007 } 1014 }
1008 1015
1016 Expression* assign_iterable_;
1009 Expression* assign_iterator_; 1017 Expression* assign_iterator_;
1010 Expression* next_result_; 1018 Expression* next_result_;
1011 Expression* result_done_; 1019 Expression* result_done_;
1012 Expression* assign_each_; 1020 Expression* assign_each_;
1013 const BailoutId back_edge_id_; 1021 const BailoutId back_edge_id_;
1014 }; 1022 };
1015 1023
1016 1024
1017 class ExpressionStatement V8_FINAL : public Statement { 1025 class ExpressionStatement V8_FINAL : public Statement {
1018 public: 1026 public:
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 3346
3339 private: 3347 private:
3340 Zone* zone_; 3348 Zone* zone_;
3341 Visitor visitor_; 3349 Visitor visitor_;
3342 }; 3350 };
3343 3351
3344 3352
3345 } } // namespace v8::internal 3353 } } // namespace v8::internal
3346 3354
3347 #endif // V8_AST_H_ 3355 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/array-iterator.js ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698