@@ -428,7 +428,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
428
428
bool disableBreakpoints,
429
429
}) async {
430
430
// TODO(798) - respect disableBreakpoints.
431
- return withEvent (() async {
431
+ return _withEvent (() async {
432
432
await isInitialized;
433
433
if (_expressionEvaluator != null ) {
434
434
await isCompilerInitialized;
@@ -448,7 +448,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
448
448
(result) => DwdsEvent ('EVALUATE' , {
449
449
'expression' : expression,
450
450
'success' : result != null && result is InstanceRef ,
451
- if (result is ErrorRef ) 'error' : result,
451
+ if (result != null && result is ErrorRef ) 'error' : result,
452
452
}));
453
453
}
454
454
@@ -458,7 +458,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
458
458
{Map <String , String > scope, bool disableBreakpoints}) async {
459
459
// TODO(798) - respect disableBreakpoints.
460
460
461
- return withEvent (() async {
461
+ return _withEvent (() async {
462
462
await isInitialized;
463
463
if (_expressionEvaluator != null ) {
464
464
await isCompilerInitialized;
@@ -485,7 +485,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
485
485
(result) => DwdsEvent ('EVALUATE_IN_FRAME' , {
486
486
'expression' : expression,
487
487
'success' : result != null && result is InstanceRef ,
488
- if (result is ErrorRef ) 'error' : result,
488
+ if (result != null && result is ErrorRef ) 'error' : result,
489
489
}));
490
490
}
491
491
@@ -525,7 +525,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
525
525
526
526
@override
527
527
Future <Isolate > getIsolate (String isolateId) async {
528
- return withEvent (() async {
528
+ return _withEvent (() async {
529
529
await isInitialized;
530
530
return _getIsolate (isolateId);
531
531
}, (result) => DwdsEvent ('GET_ISOLATE' , {}));
@@ -540,16 +540,19 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
540
540
@override
541
541
Future <Obj > getObject (String isolateId, String objectId,
542
542
{int offset, int count}) async {
543
- return await withEvent (() async {
543
+ return await _withEvent (() async {
544
544
await isInitialized;
545
545
return await _inspector? .getObject (isolateId, objectId,
546
546
offset: offset, count: count);
547
- }, (result) => DwdsEvent ('GET_OBJECT' , {'type' : result.type}));
547
+ },
548
+ (result) => DwdsEvent ('GET_OBJECT' , {
549
+ if (result != null ) 'type' : result.type,
550
+ }));
548
551
}
549
552
550
553
@override
551
554
Future <ScriptList > getScripts (String isolateId) async {
552
- return await withEvent (() async {
555
+ return await _withEvent (() async {
553
556
await isInitialized;
554
557
return await _inspector? .getScripts (isolateId);
555
558
}, (result) => DwdsEvent ('GET_SCRIPTS' , {}));
@@ -562,7 +565,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
562
565
int endTokenPos,
563
566
bool forceCompile,
564
567
bool reportLines}) async {
565
- var result = await withEvent (() async {
568
+ var result = await _withEvent (() async {
566
569
await isInitialized;
567
570
return await _inspector? .getSourceReport (isolateId, reports,
568
571
scriptId: scriptId,
@@ -595,7 +598,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
595
598
596
599
@override
597
600
Future <VM > getVM () async {
598
- return withEvent (() async {
601
+ return _withEvent (() async {
599
602
await isInitialized;
600
603
return _vm;
601
604
}, (result) => DwdsEvent ('GET_VM' , {}));
@@ -1069,7 +1072,12 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
1069
1072
String isolateId, String breakpointId, bool enable) =>
1070
1073
throw UnimplementedError ();
1071
1074
1072
- Future <T > withEvent <T >(
1075
+ /// Call [function] and record its execution time.
1076
+ ///
1077
+ /// Calls [event] to create the event to be recorded,
1078
+ /// and appends time and exception details to it if
1079
+ /// available.
1080
+ Future <T > _withEvent <T >(
1073
1081
Future <T > Function () function, DwdsEvent Function (T result) event) async {
1074
1082
var stopwatch = Stopwatch ()..start ();
1075
1083
T result;
0 commit comments