OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 InspectorTest.log('Return break locations within function'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Return break locati
ons within function'); |
6 | 6 |
7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
8 function fib(x) { | 8 function fib(x) { |
9 if (x < 0) return; | 9 if (x < 0) return; |
10 if (x === 0) return 1; | 10 if (x === 0) return 1; |
11 if (x === 1) return fib(0); | 11 if (x === 1) return fib(0); |
12 return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0); | 12 return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0); |
13 } | 13 } |
14 `); | 14 `); |
15 | 15 |
16 InspectorTest.runAsyncTestSuite([ | 16 InspectorTest.runAsyncTestSuite([ |
17 async function testTailCall() { | 17 async function testTailCall() { |
18 var scriptPromise = Protocol.Debugger.onceScriptParsed(); | 18 var scriptPromise = Protocol.Debugger.onceScriptParsed(); |
19 Protocol.Debugger.enable(); | 19 Protocol.Debugger.enable(); |
20 var scriptId = (await scriptPromise).params.scriptId; | 20 var scriptId = (await scriptPromise).params.scriptId; |
21 var locations = (await Protocol.Debugger.getPossibleBreakpoints({ | 21 var locations = (await Protocol.Debugger.getPossibleBreakpoints({ |
22 start: { lineNumber: 0, columnNumber: 0, scriptId } | 22 start: { lineNumber: 0, columnNumber: 0, scriptId } |
23 })).result.locations; | 23 })).result.locations; |
24 InspectorTest.logMessage(locations.filter(location => location.type === 'ret
urn')); | 24 InspectorTest.logMessage(locations.filter(location => location.type === 'ret
urn')); |
25 } | 25 } |
26 ]); | 26 ]); |
OLD | NEW |