(scopeDescriptor: string)
| 46 | } |
| 47 | |
| 48 | export function parseScopeChain(scopeDescriptor: string): ScopePosition[] { |
| 49 | // Identify function scope. |
| 50 | const functionStart = scopeDescriptor.indexOf('{'); |
| 51 | if (functionStart < 0) { |
| 52 | throw new Error('Test descriptor must contain "{"'); |
| 53 | } |
| 54 | const functionEnd = scopeDescriptor.indexOf('}', functionStart); |
| 55 | if (functionEnd < 0) { |
| 56 | throw new Error('Test descriptor must contain "}"'); |
| 57 | } |
| 58 | |
| 59 | const scopeChain = |
| 60 | [scopePositionFromOffsets(scopeDescriptor, Protocol.Debugger.ScopeType.Local, functionStart, functionEnd + 1)]; |
| 61 | |
| 62 | // Find the block scope. |
| 63 | const blockScopeStart = scopeDescriptor.indexOf('<'); |
| 64 | if (blockScopeStart >= 0) { |
| 65 | const blockScopeEnd = scopeDescriptor.indexOf('>'); |
| 66 | if (blockScopeEnd < 0) { |
| 67 | throw new Error('Test descriptor must contain matching "." for "<"'); |
| 68 | } |
| 69 | scopeChain.unshift(scopePositionFromOffsets( |
| 70 | scopeDescriptor, Protocol.Debugger.ScopeType.Block, blockScopeStart, blockScopeEnd + 1)); |
| 71 | } |
| 72 | |
| 73 | return scopeChain; |
| 74 | } |
| 75 | |
| 76 | interface SetBreakpointByUrlResponseHandler { |
| 77 | response: Promise<CommandHandlerResponse<'Debugger.setBreakpointByUrl'>>; |
no test coverage detected