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

Side by Side Diff: test/mjsunit/harmony/iterator-close.js

Issue 1731773003: Ensure IteratorClose is called for errors in non-declaring assignments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and fix test262 expectation Created 4 years, 10 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.cc ('k') | test/test262/test262.status » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 // Flags: --harmony-iterator-close 5 // Flags: --harmony-iterator-close
6 6
7 function* g() { yield 42; return 88 }; 7 function* g() { yield 42; return 88 };
8 8
9 9
10 // Return method is "undefined". 10 // Return method is "undefined".
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 })()); 148 })());
149 assertEquals([[]], log); 149 assertEquals([[]], log);
150 150
151 log = []; 151 log = [];
152 assertEquals(42, eval('for (let x of g()) { x; }')); 152 assertEquals(42, eval('for (let x of g()) { x; }'));
153 assertEquals([], log); 153 assertEquals([], log);
154 154
155 log = []; 155 log = [];
156 assertEquals(42, eval('for (x of g()) { x; }')); 156 assertEquals(42, eval('for (x of g()) { x; }'));
157 assertEquals([], log); 157 assertEquals([], log);
158
159 // Even if doing the assignment throws, still call return
160 x = { set attr(_) { throw 1234; } };
161 assertThrowsEquals(() => {
162 for (x.attr of g()) { throw 456; }
163 }, 1234);
164 assertEquals([[]], log);
158 } 165 }
159 166
160 167
161 // Return method throws. 168 // Return method throws.
162 { 169 {
163 let log = []; 170 let log = [];
164 g.prototype.return = (...args) => { log.push(args); throw 23 }; 171 g.prototype.return = (...args) => { log.push(args); throw 23 };
165 172
166 log = []; 173 log = [];
167 assertThrowsEquals(() => { 174 assertThrowsEquals(() => {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 for (let x of g1()) { 364 for (let x of g1()) {
358 try { 365 try {
359 for (let y of g2()) { 366 for (let y of g2()) {
360 } 367 }
361 } catch (_) {} 368 } catch (_) {}
362 if (x == 2) break; 369 if (x == 2) break;
363 } 370 }
364 }, 5); 371 }, 5);
365 assertEquals([1], log); 372 assertEquals([1], log);
366 } 373 }
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698