Index: test/mjsunit/debug-scopes.js |
diff --git a/test/mjsunit/debug-scopes.js b/test/mjsunit/debug-scopes.js |
index ce37d2402305f5200023794475f1e74a770eb450..e987c17b82212e4320810702620a6de95cd50edb 100644 |
--- a/test/mjsunit/debug-scopes.js |
+++ b/test/mjsunit/debug-scopes.js |
@@ -25,7 +25,7 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --expose-debug-as debug --allow-natives-syntax |
+// Flags: --expose-debug-as debug --allow-natives-syntax --harmony-generators |
// The functions used for testing backtraces. They are at the top to make the |
// testing of source line/column easier. |
@@ -61,7 +61,9 @@ Debug.setListener(listener); |
// Initialize for a new test. |
function BeginTest(name) { |
test_name = name; |
- listener_delegate = null; |
+ var keep_listener = name.match(/^Generator/); |
+ if (!keep_listener) |
+ listener_delegate = null; |
listener_called = false; |
exception = null; |
begin_test_count++; |
@@ -70,7 +72,7 @@ function BeginTest(name) { |
// Check result of a test. |
function EndTest() { |
- assertTrue(listener_called, "listerner not called for " + test_name); |
+ assertTrue(listener_called, "listener not called for " + test_name); |
assertNull(exception, test_name + " / " + exception); |
end_test_count++; |
} |
@@ -222,6 +224,14 @@ local_1(); |
EndTest(); |
+BeginTest("Generator Local 1"); |
+function *generator_local_1() { |
+ debugger; |
+} |
+generator_local_1().next(); |
+EndTest(); |
+ |
+ |
// Local scope with a parameter. |
BeginTest("Local 2"); |
@@ -238,6 +248,14 @@ local_2(1); |
EndTest(); |
+BeginTest("Generator Local 2"); |
+function *generator_local_2(a) { |
+ debugger; |
+} |
+generator_local_2(1).next(); |
+EndTest(); |
+ |
+ |
// Local scope with a parameter and a local variable. |
BeginTest("Local 3"); |
@@ -255,6 +273,15 @@ local_3(1); |
EndTest(); |
+BeginTest("Generator Local 3"); |
+function *generator_local_3(a) { |
+ var x = 3; |
+ debugger; |
+} |
+generator_local_3(1).next(); |
+EndTest(); |
+ |
+ |
// Local scope with parameters and local variables. |
BeginTest("Local 4"); |
@@ -290,6 +317,15 @@ local_5(); |
EndTest(); |
+BeginTest("Generator Local 5"); |
+function *generator_local_5() { |
+ eval(''); |
+ debugger; |
+} |
+generator_local_5().next(); |
+EndTest(); |
+ |
+ |
// Local introducing local variable using eval. |
BeginTest("Local 6"); |
@@ -307,6 +343,15 @@ local_6(); |
EndTest(); |
+BeginTest("Generator Local 6"); |
+function *generator_local_6() { |
+ eval('var i = 5'); |
+ debugger; |
+} |
+generator_local_6().next(); |
+EndTest(); |
+ |
+ |
// Local scope with parameters, local variables and local variable introduced |
// using eval. |
BeginTest("Local 7"); |
@@ -328,6 +373,18 @@ local_7(1, 2); |
EndTest(); |
+BeginTest("Generator Local 7"); |
+function *generator_local_7(a, b) { |
+ var x = 3; |
+ var y = 4; |
+ eval('var i = 5'); |
+ eval('var j = 6'); |
+ debugger; |
+} |
+generator_local_7(1, 2).next(); |
+EndTest(); |
+ |
+ |
// Single empty with block. |
BeginTest("With 1"); |
@@ -370,6 +427,18 @@ with_2(); |
EndTest(); |
+BeginTest("Generator With 2"); |
+function *generator_with_2() { |
+ with({}) { |
+ with({}) { |
+ debugger; |
+ } |
+ } |
+} |
+generator_with_2().next(); |
+EndTest(); |
+ |
+ |
// With block using an in-place object literal. |
BeginTest("With 3"); |
@@ -484,11 +553,10 @@ EndTest(); |
BeginTest("Closure 1"); |
function closure_1(a) { |
- function f() { |
+ return function() { |
debugger; |
return a; |
}; |
- return f; |
} |
listener_delegate = function(exec_state) { |
@@ -501,6 +569,17 @@ closure_1(1)(); |
EndTest(); |
+BeginTest("Generator Closure 1"); |
+function *generator_closure_1(a) { |
+ return function() { |
+ debugger; |
+ return a; |
+ }; |
+} |
+generator_closure_1(1).next().value(); |
+EndTest(); |
+ |
+ |
// Simple closure formed by returning an inner function referering the outer |
// functions arguments. Due to VM optimizations parts of the actual closure is |
// missing from the debugger information. |
@@ -758,6 +837,36 @@ the_full_monty(1, 2)(); |
EndTest(); |
+BeginTest("Generator the full monty"); |
+function* generator_the_full_monty(a, b) { |
+ var x = 3; |
+ var y = 4; |
+ eval('var i = 5'); |
+ eval('var j = 6'); |
+ function f(a, b) { |
+ var x = 9; |
+ var y = 10; |
+ eval('var i = 11'); |
+ eval('var j = 12'); |
+ with ({j:13}){ |
+ return function() { |
+ var x = 14; |
+ with ({a:15}) { |
+ with ({b:16}) { |
+ debugger; |
+ some_global = a; |
+ return f; |
+ } |
+ } |
+ }; |
+ } |
+ } |
+ return f(a, b); |
+} |
+generator_the_full_monty(1, 2).next().value(); |
+EndTest(); |
+ |
+ |
BeginTest("Closure inside With 1"); |
function closure_in_with_1() { |
with({x:1}) { |
@@ -878,6 +987,18 @@ catch_block_1(); |
EndTest(); |
+BeginTest("Generator catch block 1"); |
+function *generator_catch_block_1() { |
+ try { |
+ throw 'Exception'; |
+ } catch (e) { |
+ debugger; |
+ } |
+}; |
+generator_catch_block_1().next(); |
+EndTest(); |
+ |
+ |
BeginTest("Catch block 2"); |
function catch_block_2() { |
try { |