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

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

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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/collections.js ('k') | test/mjsunit/harmony/proxies.js » ('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 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 listener_delegate = function(exec_state) { 457 listener_delegate = function(exec_state) {
458 CheckScopeChain([debug.ScopeType.Local, 458 CheckScopeChain([debug.ScopeType.Local,
459 debug.ScopeType.Block, 459 debug.ScopeType.Block,
460 debug.ScopeType.Closure, 460 debug.ScopeType.Closure,
461 debug.ScopeType.Global], exec_state); 461 debug.ScopeType.Global], exec_state);
462 CheckScopeContent({}, 0, exec_state); 462 CheckScopeContent({}, 0, exec_state);
463 CheckScopeContent({a:1,x:2,y:3}, 2, exec_state); 463 CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
464 }; 464 };
465 closure_1(1)(); 465 closure_1(1)();
466 EndTest(); 466 EndTest();
467
468
469 // Simple for-in loop over the keys of an object.
470 BeginTest("For loop 1");
471
472 function for_loop_1() {
473 for (let x in {y:undefined}) {
474 debugger;
475 }
476 }
477
478 listener_delegate = function(exec_state) {
479 CheckScopeChain([debug.ScopeType.Block,
480 debug.ScopeType.Local,
481 debug.ScopeType.Global], exec_state);
482 CheckScopeContent({x:'y'}, 0, exec_state);
483 // The function scope contains a temporary iteration variable.
484 CheckScopeContent({x:'y'}, 1, exec_state);
485 };
486 for_loop_1();
487 EndTest();
488
489
490 // For-in loop over the keys of an object with a block scoped let variable
491 // shadowing the iteration variable.
492 BeginTest("For loop 2");
493
494 function for_loop_2() {
495 for (let x in {y:undefined}) {
496 let x = 3;
497 debugger;
498 }
499 }
500
501 listener_delegate = function(exec_state) {
502 CheckScopeChain([debug.ScopeType.Block,
503 debug.ScopeType.Block,
504 debug.ScopeType.Local,
505 debug.ScopeType.Global], exec_state);
506 CheckScopeContent({x:3}, 0, exec_state);
507 CheckScopeContent({x:'y'}, 1, exec_state);
508 // The function scope contains a temporary iteration variable.
509 CheckScopeContent({x:'y'}, 2, exec_state);
510 };
511 for_loop_2();
512 EndTest();
513
514
515 // Simple for loop.
516 BeginTest("For loop 3");
517
518 function for_loop_3() {
519 for (let x = 3; x < 4; ++x) {
520 debugger;
521 }
522 }
523
524 listener_delegate = function(exec_state) {
525 CheckScopeChain([debug.ScopeType.Block,
526 debug.ScopeType.Local,
527 debug.ScopeType.Global], exec_state);
528 CheckScopeContent({x:3}, 0, exec_state);
529 CheckScopeContent({}, 1, exec_state);
530 };
531 for_loop_3();
532 EndTest();
533
534
535 // For loop with a block scoped let variable shadowing the iteration variable.
536 BeginTest("For loop 4");
537
538 function for_loop_4() {
539 for (let x = 3; x < 4; ++x) {
540 let x = 5;
541 debugger;
542 }
543 }
544
545 listener_delegate = function(exec_state) {
546 CheckScopeChain([debug.ScopeType.Block,
547 debug.ScopeType.Block,
548 debug.ScopeType.Local,
549 debug.ScopeType.Global], exec_state);
550 CheckScopeContent({x:5}, 0, exec_state);
551 CheckScopeContent({x:3}, 1, exec_state);
552 CheckScopeContent({}, 2, exec_state);
553 };
554 for_loop_4();
555 EndTest();
556
557
558 // For loop with two variable declarations.
559 BeginTest("For loop 5");
560
561 function for_loop_5() {
562 for (let x = 3, y = 5; x < 4; ++x) {
563 debugger;
564 }
565 }
566
567 listener_delegate = function(exec_state) {
568 CheckScopeChain([debug.ScopeType.Block,
569 debug.ScopeType.Local,
570 debug.ScopeType.Global], exec_state);
571 CheckScopeContent({x:3,y:5}, 0, exec_state);
572 CheckScopeContent({}, 1, exec_state);
573 };
574 for_loop_5();
575 EndTest();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/collections.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698