| OLD | NEW |
| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 BeginTest("For loop 1"); | 365 BeginTest("For loop 1"); |
| 366 | 366 |
| 367 function for_loop_1() { | 367 function for_loop_1() { |
| 368 for (let x in {y:undefined}) { | 368 for (let x in {y:undefined}) { |
| 369 debugger; | 369 debugger; |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 | 372 |
| 373 listener_delegate = function(exec_state) { | 373 listener_delegate = function(exec_state) { |
| 374 CheckScopeChain([debug.ScopeType.Block, | 374 CheckScopeChain([debug.ScopeType.Block, |
| 375 debug.ScopeType.Block, |
| 375 debug.ScopeType.Local, | 376 debug.ScopeType.Local, |
| 376 debug.ScopeType.Script, | 377 debug.ScopeType.Script, |
| 377 debug.ScopeType.Global], exec_state); | 378 debug.ScopeType.Global], exec_state); |
| 378 CheckScopeContent({x:'y'}, 0, exec_state); | 379 CheckScopeContent({x:'y'}, 0, exec_state); |
| 379 // The function scope contains a temporary iteration variable, but it is | 380 // The function scope contains a temporary iteration variable, but it is |
| 380 // hidden to the debugger. | 381 // hidden to the debugger. |
| 381 CheckScopeContent({}, 1, exec_state); | 382 // TODO(adamk): This variable is only used to provide a TDZ for the enumerable |
| 383 // expression and should not be visible to the debugger. |
| 384 CheckScopeContent({x:undefined}, 1, exec_state); |
| 382 }; | 385 }; |
| 383 for_loop_1(); | 386 for_loop_1(); |
| 384 EndTest(); | 387 EndTest(); |
| 385 | 388 |
| 386 | 389 |
| 387 // For-in loop over the keys of an object with a block scoped let variable | 390 // For-in loop over the keys of an object with a block scoped let variable |
| 388 // shadowing the iteration variable. | 391 // shadowing the iteration variable. |
| 389 BeginTest("For loop 2"); | 392 BeginTest("For loop 2"); |
| 390 | 393 |
| 391 function for_loop_2() { | 394 function for_loop_2() { |
| 392 for (let x in {y:undefined}) { | 395 for (let x in {y:undefined}) { |
| 393 let x = 3; | 396 let x = 3; |
| 394 debugger; | 397 debugger; |
| 395 } | 398 } |
| 396 } | 399 } |
| 397 | 400 |
| 398 listener_delegate = function(exec_state) { | 401 listener_delegate = function(exec_state) { |
| 399 CheckScopeChain([debug.ScopeType.Block, | 402 CheckScopeChain([debug.ScopeType.Block, |
| 400 debug.ScopeType.Block, | 403 debug.ScopeType.Block, |
| 404 debug.ScopeType.Block, |
| 401 debug.ScopeType.Local, | 405 debug.ScopeType.Local, |
| 402 debug.ScopeType.Script, | 406 debug.ScopeType.Script, |
| 403 debug.ScopeType.Global], exec_state); | 407 debug.ScopeType.Global], exec_state); |
| 404 CheckScopeContent({x:3}, 0, exec_state); | 408 CheckScopeContent({x:3}, 0, exec_state); |
| 405 CheckScopeContent({x:'y'}, 1, exec_state); | 409 CheckScopeContent({x:'y'}, 1, exec_state); |
| 406 // The function scope contains a temporary iteration variable, hidden to the | 410 // The function scope contains a temporary iteration variable, hidden to the |
| 407 // debugger. | 411 // debugger. |
| 408 CheckScopeContent({}, 2, exec_state); | 412 // TODO(adamk): This variable is only used to provide a TDZ for the enumerable |
| 413 // expression and should not be visible to the debugger. |
| 414 CheckScopeContent({x:undefined}, 2, exec_state); |
| 409 }; | 415 }; |
| 410 for_loop_2(); | 416 for_loop_2(); |
| 411 EndTest(); | 417 EndTest(); |
| 412 | 418 |
| 413 | 419 |
| 414 // Simple for loop. | 420 // Simple for loop. |
| 415 BeginTest("For loop 3"); | 421 BeginTest("For loop 3"); |
| 416 | 422 |
| 417 function for_loop_3() { | 423 function for_loop_3() { |
| 418 for (let x = 3; x < 4; ++x) { | 424 for (let x = 3; x < 4; ++x) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 assertEquals(27, j); | 541 assertEquals(27, j); |
| 536 } | 542 } |
| 537 assertEquals(0, i); | 543 assertEquals(0, i); |
| 538 } | 544 } |
| 539 | 545 |
| 540 listener_delegate = function (exec_state) { | 546 listener_delegate = function (exec_state) { |
| 541 exec_state.frame(0).evaluate("j = 27"); | 547 exec_state.frame(0).evaluate("j = 27"); |
| 542 } | 548 } |
| 543 shadowing_2(); | 549 shadowing_2(); |
| 544 EndTest(); | 550 EndTest(); |
| OLD | NEW |