[vm] Fix crashes on record types in mirrors and observatory

TEST=ci, manually verified tests with https://dart-review.googlesource.com/c/sdk/+/290760.

Fixes https://github.com/dart-lang/sdk/issues/51900

Change-Id: I338bc1b1f2e58d2343f6195ff9d12151edbd90dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291969
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov
2023-03-30 18:42:08 +00:00
committed by Commit Queue
parent 134007af32
commit 3da80be140
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -530,6 +530,12 @@ static InstancePtr CreateTypeMirror(const AbstractType& type) {
if (type.IsFunctionType()) {
return CreateFunctionTypeMirror(type);
}
if (type.IsRecordType()) {
const Class& cls =
Class::Handle(IsolateGroup::Current()->object_store()->record_class());
return CreateClassMirror(cls, AbstractType::Handle(cls.DeclarationType()),
Bool::False(), Object::null_instance());
}
if (type.HasTypeClass()) {
const Class& cls = Class::Handle(type.type_class());
// Handle void and dynamic types.
@@ -2782,9 +2782,9 @@ M.InstanceKind stringToInstanceKind(String s) {
return M.InstanceKind.typeRef;
case 'ReceivePort':
return M.InstanceKind.receivePort;
case '_RecordType':
case 'RecordType':
return M.InstanceKind.recordType;
case '_Record':
case 'Record':
return M.InstanceKind.record;
case 'Finalizer':
return M.InstanceKind.finalizer;