Skip to content

Commit 389d66a

Browse files
Anna GringauzeCommit Queue
authored andcommitted
Fix inner DDC types display
Closes: #54694 Change-Id: Ie141959eedc9cdbb5c675d33da985eb1ac5588e1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347761 Reviewed-by: Nicholas Shahan <[email protected]> Commit-Queue: Anna Gringauze <[email protected]>
1 parent e78c0cf commit 389d66a

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

pkg/dev_compiler/test/expression_compiler/expression_compiler_e2e_suite.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ class ExpressionEvaluationTestDriver {
772772
/// }
773773
Future<String> stringifyRemoteObject(wip.RemoteObject obj) async {
774774
String str;
775-
switch (obj.type) {
775+
final type = obj.json.containsKey('type') ? obj.type : null;
776+
switch (type) {
776777
case 'function':
777778
str = obj.description ?? '';
778779
break;

pkg/dev_compiler/test/expression_compiler/runtime_debugger_api_test.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,62 @@ void runSharedTests(
553553
);
554554
});
555555

556+
test('getObjectMetadata (DartType)', () async {
557+
final innerType = 'dart.dloadRepl(object.runtimeType, "_type")';
558+
final typeName = await driver.evaluateJsExpression(
559+
breakpointId: 'BP',
560+
expression: '$innerType.toString()',
561+
);
562+
expect(typeName, startsWith('class Object'));
563+
564+
await driver.checkRuntimeInFrame(
565+
breakpointId: 'BP',
566+
expression: 'dart.getObjectMetadata($innerType)',
567+
expectedResult: {
568+
'className': 'Type',
569+
'libraryId': null,
570+
'runtimeKind': 'function',
571+
'length': 0,
572+
});
573+
}, skip: 'Only applies to old type system');
574+
575+
test('getObjectMetadata (RecordType)', () async {
576+
final innerType = 'dart.dloadRepl(record.runtimeType, "_type")';
577+
final typeName = await driver.evaluateJsExpression(
578+
breakpointId: 'BP',
579+
expression: '$innerType.toString()',
580+
);
581+
expect(typeName, '(int, int, {String name})');
582+
583+
await driver.checkRuntimeInFrame(
584+
breakpointId: 'BP',
585+
expression: 'dart.getObjectMetadata($innerType)',
586+
expectedResult: {
587+
'className': 'Type',
588+
'libraryId': 'dart:core',
589+
'runtimeKind': 'type',
590+
'typeName': '(int, int, {String name})'
591+
});
592+
}, skip: 'Only applies to old type system');
593+
594+
test('getObjectMetadata (Rti)', () async {
595+
final rti = 'dart.dloadRepl(object.runtimeType, "_rti")';
596+
final typeName = await driver.evaluateJsExpression(
597+
breakpointId: 'BP',
598+
expression: '$rti.runtimeType.toString()',
599+
);
600+
expect(typeName, 'Rti');
601+
602+
await driver.checkRuntimeInFrame(
603+
breakpointId: 'BP',
604+
expression: 'dart.getObjectMetadata($rti)',
605+
expectedResult: {
606+
'className': typeName,
607+
'libraryId': 'dart:_rti',
608+
'runtimeKind': 'object',
609+
});
610+
});
611+
556612
test('getObjectFieldNames (object)', () async {
557613
await driver.checkRuntimeInFrame(
558614
breakpointId: 'BP',

sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ bool _isRecordType(@notNull Type type) {
532532
if (JS_GET_FLAG('NEW_RUNTIME_TYPES')) {
533533
return rti.isRecordType(type);
534534
} else {
535-
return isRecordType(type);
535+
return type is _Type ? isRecordType(type) : false;
536536
}
537537
}
538538

0 commit comments

Comments
 (0)