Skip to content

Preliminary support for record types when vm_service <10.0.0 #5028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

elliette
Copy link
Member

@elliette elliette commented Jan 11, 2023

From what I can tell, we don't yet have access to the field names for records when vm_service is <10.0.0. This adds preliminary support for records by simply displaying the values without names.

Inspecting the following shows:

var record = (1, a: "Hello there", 3, b: 4, true);

Screenshot 2023-01-10 at 4 24 43 PM

RELEASE_NOTE_EXCEPTION='Record types not fully supported yet, will update release notes once they are'

@elliette elliette requested a review from a team as a code owner January 11, 2023 00:30
@elliette elliette requested review from bkonyi and removed request for a team and bkonyi January 11, 2023 00:30
@bkonyi
Copy link
Contributor

bkonyi commented Jan 11, 2023

Good timing! vm_service 10.0.0 was just published yesterday 🥳

Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for now, since I think it'll take Derek some time to roll vm_service through the DevTools deps.

@kenzieschmoll
Copy link
Member

Is the record unordered?
var record = (1, a: "Hello there", 3, b: 4, true); doesn't appear to match the order in your screenshot

@elliette
Copy link
Member Author

Is the record unordered? var record = (1, a: "Hello there", 3, b: 4, true); doesn't appear to match the order in your screenshot

I don't think vm_service (at version <10.0.0) is providing order information. @bkonyi correct me if I'm wrong. We are currently just displaying what we get back from the vm_service, in the order that we get it. In this case, vm_service returns:

[

// int 1
[BoundField decl: null, value: [InstanceRef id: objects/int-1, kind: Int, identityHashCode: 0, classRef: [ClassRef id: classes/59, name: _Smi, library: [LibraryRef id: libraries/@0150898, name: dart.core, uri: dart:core]]]], 

// int 3
[BoundField decl: null, value: [InstanceRef id: objects/int-3, kind: Int, identityHashCode: 0, classRef: [ClassRef id: classes/59, name: _Smi, library: [LibraryRef id: libraries/@0150898, name: dart.core, uri: dart:core]]]], 

// bool true
[BoundField decl: null, value: [InstanceRef id: objects/bool-true, kind: Bool, identityHashCode: 0, classRef: [ClassRef id: classes/62, name: bool, library: [LibraryRef id: libraries/@0150898, name: dart.core, uri: dart:core]]]],

// String "hello there"
[BoundField decl: null, value: [InstanceRef id: objects/1419, kind: String, identityHashCode: 0, classRef: [ClassRef id: classes/93, name: _OneByteString, library: [LibraryRef id: libraries/@0150898, name: dart.core, uri: dart:core]]]], 

// int 4
[BoundField decl: null, value: [InstanceRef id: objects/int-4, kind: Int, identityHashCode: 0, classRef: [ClassRef id: classes/59, name: _Smi, library: [LibraryRef id: libraries/@0150898, name: dart.core, uri: dart:core]]]]

]

@elliette
Copy link
Member Author

Follow up on ordering (from @derekxu16):

With vm_service < 10.0.0 clients can't get the field names, so there's no way to determine the order. With the field names you can tell which are positional, because the names will be ints instead of Strings. Under the hood, the service returns all the positional fields in order first, and then all the named fields.

@elliette elliette merged commit 4f22819 into flutter:master Jan 11, 2023
@elliette elliette linked an issue Jan 12, 2023 that may be closed by this pull request
@CoderDake CoderDake mentioned this pull request Jan 24, 2023
7 tasks
@DartDevtoolWorkflowBot DartDevtoolWorkflowBot mentioned this pull request Jan 24, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for inspecting record types
3 participants