| Index: test/mjsunit/harmony/debug-blockscopes.js
|
| diff --git a/test/mjsunit/harmony/debug-blockscopes.js b/test/mjsunit/harmony/debug-blockscopes.js
|
| index 10aac2dbd417f20d540fa4bf58aa0d52d3d3151e..1e043e106c4470eee97a67c43d560deb17335ce2 100644
|
| --- a/test/mjsunit/harmony/debug-blockscopes.js
|
| +++ b/test/mjsunit/harmony/debug-blockscopes.js
|
| @@ -309,7 +309,7 @@ local_6(1);
|
| EndTest();
|
|
|
|
|
| -// Two variables in a block scope.
|
| +// A variable in a block scope within an unallocated block.
|
| BeginTest("Local 7");
|
|
|
| function local_7(a) {
|
| @@ -332,6 +332,33 @@ local_7(1);
|
| EndTest();
|
|
|
|
|
| +// Function and block scopes with stack allocated variables.
|
| +BeginTest("Local 8");
|
| +
|
| +function local_8(a) {
|
| + let z = 10;
|
| + {
|
| + let y = 20;
|
| + {
|
| + let x = 8;
|
| + debugger;
|
| + }
|
| + }
|
| +}
|
| +
|
| +listener_delegate = function(exec_state) {
|
| + CheckScopeChain([debug.ScopeType.Block,
|
| + debug.ScopeType.Block,
|
| + debug.ScopeType.Local,
|
| + debug.ScopeType.Global], exec_state);
|
| + CheckScopeContent({x:8}, 0, exec_state);
|
| + CheckScopeContent({y:20}, 1, exec_state);
|
| + CheckScopeContent({a:1,z:10}, 2, exec_state);
|
| +};
|
| +local_8(1);
|
| +EndTest();
|
| +
|
| +
|
| // Simple closure formed by returning an inner function referering to an outer
|
| // block local variable and an outer function's parameter.
|
| BeginTest("Closure 1");
|
| @@ -341,11 +368,13 @@ function closure_1(a) {
|
| let y = 3;
|
| if (true) {
|
| let z = 4;
|
| - function f() {
|
| - debugger;
|
| - return a + x + y + z;
|
| - };
|
| - return f;
|
| + { // Stack allocated block
|
| + function f() {
|
| + debugger;
|
| + return a + x + y + z;
|
| + };
|
| + return f;
|
| + }
|
| }
|
| }
|
|
|
| @@ -355,6 +384,7 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Closure,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({}, 0, exec_state);
|
| + CheckScopeContent({z:4}, 1, exec_state);
|
| CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
|
| };
|
| closure_1(1)();
|
| @@ -468,3 +498,18 @@ listener_delegate = function(exec_state) {
|
| };
|
| for_loop_5();
|
| EndTest();
|
| +
|
| +
|
| +// Nested scoped block in global code.
|
| +BeginTest("Global block 1");
|
| +listener_delegate = function(exec_state) {
|
| + CheckScopeChain([debug.ScopeType.Block,
|
| + debug.ScopeType.Global], exec_state);
|
| + CheckScopeContent({e:10}, 0, exec_state);
|
| +};
|
| +
|
| +{
|
| + let e = 10;
|
| + debugger;
|
| +}
|
| +EndTest();
|
|
|