mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
fix stack frame parser (#69253)
This commit is contained in:
parent
e5c4c4b27a
commit
46b1b67797
|
@ -211,7 +211,9 @@ class StackFrame {
|
|||
String className = '';
|
||||
String method = match.group(2)!.replaceAll('.<anonymous closure>', '');
|
||||
if (method.startsWith('new')) {
|
||||
className = method.split(' ')[1];
|
||||
final List<String> methodParts = method.split(' ');
|
||||
// Sometimes a web frame will only read "new" and have no class name.
|
||||
className = methodParts.length > 1 ? method.split(' ')[1] : '<unknown>';
|
||||
method = '';
|
||||
if (className.contains('.')) {
|
||||
final List<String> parts = className.split('.');
|
||||
|
|
|
@ -81,6 +81,24 @@ void main() {
|
|||
expect('$e', contains('Got a stack frame from package:stack_trace'));
|
||||
}
|
||||
});
|
||||
|
||||
test('Can parse web constructor invocation with unknown class name', () {
|
||||
const String stackTraceLine = '#32 new (http://localhost:42191/dart-sdk/lib/async/stream_controller.dart:880:9)';
|
||||
expect(
|
||||
StackFrame.fromStackTraceLine(stackTraceLine),
|
||||
const StackFrame(
|
||||
number: 32,
|
||||
className: '<unknown>',
|
||||
method: '',
|
||||
packageScheme: 'http',
|
||||
package: '<unknown>',
|
||||
packagePath: 'dart-sdk/lib/async/stream_controller.dart',
|
||||
line: 880,
|
||||
column: 9,
|
||||
source: stackTraceLine,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const String stackString = '''
|
||||
|
|
Loading…
Reference in a new issue