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

Side by Side Diff: test/mjsunit/harmony/debug-blockscopes.js

Issue 292743009: Make let variables fresh in each iteration of a for-loop. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 7 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 | « test/mjsunit/harmony/block-for.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 BeginTest("For loop 3"); 405 BeginTest("For loop 3");
406 406
407 function for_loop_3() { 407 function for_loop_3() {
408 for (let x = 3; x < 4; ++x) { 408 for (let x = 3; x < 4; ++x) {
409 debugger; 409 debugger;
410 } 410 }
411 } 411 }
412 412
413 listener_delegate = function(exec_state) { 413 listener_delegate = function(exec_state) {
414 CheckScopeChain([debug.ScopeType.Block, 414 CheckScopeChain([debug.ScopeType.Block,
415 debug.ScopeType.Block,
415 debug.ScopeType.Local, 416 debug.ScopeType.Local,
416 debug.ScopeType.Global], exec_state); 417 debug.ScopeType.Global], exec_state);
417 CheckScopeContent({x:3}, 0, exec_state); 418 CheckScopeContent({x:3}, 0, exec_state);
418 CheckScopeContent({}, 1, exec_state); 419 CheckScopeContent({x:3}, 1, exec_state);
420 CheckScopeContent({}, 2, exec_state);
419 }; 421 };
420 for_loop_3(); 422 for_loop_3();
421 EndTest(); 423 EndTest();
422 424
423 425
424 // For loop with a block scoped let variable shadowing the iteration variable. 426 // For loop with a block scoped let variable shadowing the iteration variable.
425 BeginTest("For loop 4"); 427 BeginTest("For loop 4");
426 428
427 function for_loop_4() { 429 function for_loop_4() {
428 for (let x = 3; x < 4; ++x) { 430 for (let x = 3; x < 4; ++x) {
429 let x = 5; 431 let x = 5;
430 debugger; 432 debugger;
431 } 433 }
432 } 434 }
433 435
434 listener_delegate = function(exec_state) { 436 listener_delegate = function(exec_state) {
435 CheckScopeChain([debug.ScopeType.Block, 437 CheckScopeChain([debug.ScopeType.Block,
436 debug.ScopeType.Block, 438 debug.ScopeType.Block,
439 debug.ScopeType.Block,
437 debug.ScopeType.Local, 440 debug.ScopeType.Local,
438 debug.ScopeType.Global], exec_state); 441 debug.ScopeType.Global], exec_state);
439 CheckScopeContent({x:5}, 0, exec_state); 442 CheckScopeContent({x:5}, 0, exec_state);
440 CheckScopeContent({x:3}, 1, exec_state); 443 CheckScopeContent({x:3}, 1, exec_state);
441 CheckScopeContent({}, 2, exec_state); 444 CheckScopeContent({x:3}, 2, exec_state);
445 CheckScopeContent({}, 3, exec_state);
442 }; 446 };
443 for_loop_4(); 447 for_loop_4();
444 EndTest(); 448 EndTest();
445 449
446 450
447 // For loop with two variable declarations. 451 // For loop with two variable declarations.
448 BeginTest("For loop 5"); 452 BeginTest("For loop 5");
449 453
450 function for_loop_5() { 454 function for_loop_5() {
451 for (let x = 3, y = 5; x < 4; ++x) { 455 for (let x = 3, y = 5; x < 4; ++x) {
452 debugger; 456 debugger;
453 } 457 }
454 } 458 }
455 459
456 listener_delegate = function(exec_state) { 460 listener_delegate = function(exec_state) {
457 CheckScopeChain([debug.ScopeType.Block, 461 CheckScopeChain([debug.ScopeType.Block,
462 debug.ScopeType.Block,
458 debug.ScopeType.Local, 463 debug.ScopeType.Local,
459 debug.ScopeType.Global], exec_state); 464 debug.ScopeType.Global], exec_state);
460 CheckScopeContent({x:3,y:5}, 0, exec_state); 465 CheckScopeContent({x:3,y:5}, 0, exec_state);
461 CheckScopeContent({}, 1, exec_state); 466 CheckScopeContent({x:3,y:5}, 1, exec_state);
467 CheckScopeContent({}, 2, exec_state);
462 }; 468 };
463 for_loop_5(); 469 for_loop_5();
464 EndTest(); 470 EndTest();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/block-for.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698