( name: string, env: ?string, location: ?Error, )
| 41 | } |
| 42 | |
| 43 | export function describeDebugInfoFrame( |
| 44 | name: string, |
| 45 | env: ?string, |
| 46 | location: ?Error, |
| 47 | ): string { |
| 48 | if (location != null) { |
| 49 | // If we have a location, it's the child's owner stack. Treat the bottom most frame as |
| 50 | // the location of this function. |
| 51 | const childStack = formatOwnerStack(location); |
| 52 | const idx = childStack.lastIndexOf('\n'); |
| 53 | const lastLine = idx === -1 ? childStack : childStack.slice(idx + 1); |
| 54 | if (lastLine.indexOf(name) !== -1) { |
| 55 | // For async stacks it's possible we don't have the owner on it. As a precaution only |
| 56 | // use this frame if it has the name of the function in it. |
| 57 | return '\n' + lastLine; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return describeBuiltInComponentFrame(name + (env ? ' [' + env + ']' : '')); |
| 62 | } |
| 63 | |
| 64 | let reentry = false; |
| 65 | let componentFrameCache; |
no test coverage detected