(formals_and_body, args, value1, value2)
| 11 | } |
| 12 | |
| 13 | function RunTest(formals_and_body, args, value1, value2) { |
| 14 | // A null listener. It isn't important what the listener does. |
| 15 | function listener(event, exec_state, event_data, data) { |
| 16 | } |
| 17 | |
| 18 | // Create the generator function outside a debugging context. It will probably |
| 19 | // be lazily compiled. |
| 20 | var gen = (function*(){}).constructor.apply(null, formals_and_body); |
| 21 | |
| 22 | // Instantiate the generator object. |
| 23 | var obj = gen.apply(null, args); |
| 24 | |
| 25 | // Advance to the first yield. |
| 26 | assertIteratorResult(value1, false, obj.next()); |
| 27 | |
| 28 | // Enable the debugger, which should force recompilation of the generator |
| 29 | // function and relocation of the suspended generator activation. |
| 30 | Debug.setListener(listener); |
| 31 | |
| 32 | gc(); |
| 33 | |
| 34 | // Add a breakpoint on line 3 (the second yield). |
| 35 | var bp = Debug.setBreakPoint(gen, 3); |
| 36 | |
| 37 | // Check that the generator resumes and suspends properly. |
| 38 | assertIteratorResult(value2, false, obj.next()); |
| 39 | |
| 40 | // Disable debugger -- should not force recompilation. |
| 41 | Debug.clearBreakPoint(bp); |
| 42 | Debug.setListener(null); |
| 43 | |
| 44 | // Run to completion. |
| 45 | assertIteratorResult(undefined, true, obj.next()); |
| 46 | } |
| 47 | |
| 48 | function prog(a, b, c) { |
| 49 | return a + ';\n' + 'yield ' + b + ';\n' + 'yield ' + c; |
no test coverage detected
searching dependent graphs…