MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / parseScopeChain

Function parseScopeChain

front_end/testing/MockScopeChain.ts:48–74  ·  view source on GitHub ↗
(scopeDescriptor: string)

Source from the content-addressed store, hash-verified

46}
47
48export 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
76interface SetBreakpointByUrlResponseHandler {
77 response: Promise<CommandHandlerResponse<'Debugger.setBreakpointByUrl'>>;

Callers 4

createCallFrameMethod · 0.85

Calls 2

scopePositionFromOffsetsFunction · 0.85
indexOfMethod · 0.80

Tested by

no test coverage detected