Skip to content

Commit ad36a98

Browse files
bkonyiCommit Queue
authored andcommitted
[ package:vm_service] Update CodeRef.function to have type dynamic
The function property of a Code object can contain either a Function or a NativeFunction. This change updates the protocol specification to properly document existing behavior and regenerates package:vm_service to update `CodeRef.function` to have a `dynamic` type. This is a breaking change to `package:vm_service`, so this will be released as 15.0.0. Related to flutter/devtools#8567 TEST=N/A Change-Id: Ie89723cdba8176be0d84a57a878fbedbca57f9c0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398260 Commit-Queue: Ben Konyi <[email protected]> Reviewed-by: Derek Xu <[email protected]> Auto-Submit: Ben Konyi <[email protected]>
1 parent 4eca32f commit ad36a98

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

pkg/vm_service/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 15.0.0
2+
- Update type of `CodeRef.function` from `FuncRef` to `dynamic` to allow for `NativeFunction`
3+
functions ([flutter/devtools #8567]).
4+
5+
[flutter/devtools #8567]: https://github.com/flutter/devtools/issues/8567
6+
17
## 14.3.1
28
- Fix crash that could occur when trying to send a service extension response
39
after the service connection had already been disposed of ([flutter/flutter #157296]).

pkg/vm_service/lib/src/vm_service.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,8 +3205,10 @@ class CodeRef extends ObjRef {
32053205
/*CodeKind*/ String? kind;
32063206

32073207
/// This code object's corresponding function.
3208+
///
3209+
/// [function] can be one of [FuncRef] or [NativeFunction].
32083210
@optional
3209-
FuncRef? function;
3211+
dynamic function;
32103212

32113213
CodeRef({
32123214
this.name,
@@ -3220,8 +3222,8 @@ class CodeRef extends ObjRef {
32203222
CodeRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
32213223
name = json['name'] ?? '';
32223224
kind = json['kind'] ?? '';
3223-
function =
3224-
createServiceObject(json['function'], const ['FuncRef']) as FuncRef?;
3225+
function = createServiceObject(
3226+
json['function'], const ['FuncRef', 'NativeFunction']) as dynamic;
32253227
}
32263228

32273229
@override
@@ -3261,9 +3263,11 @@ class Code extends Obj implements CodeRef {
32613263
/*CodeKind*/ String? kind;
32623264

32633265
/// This code object's corresponding function.
3266+
///
3267+
/// [function] can be one of [FuncRef] or [NativeFunction].
32643268
@optional
32653269
@override
3266-
FuncRef? function;
3270+
dynamic function;
32673271

32683272
Code({
32693273
this.name,
@@ -3277,8 +3281,8 @@ class Code extends Obj implements CodeRef {
32773281
Code._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
32783282
name = json['name'] ?? '';
32793283
kind = json['kind'] ?? '';
3280-
function =
3281-
createServiceObject(json['function'], const ['FuncRef']) as FuncRef?;
3284+
function = createServiceObject(
3285+
json['function'], const ['FuncRef', 'NativeFunction']) as dynamic;
32823286
}
32833287

32843288
@override

pkg/vm_service/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: vm_service
2-
version: 14.3.1
2+
version: 15.0.0
33
description: >-
44
A library to communicate with a service implementing the Dart VM
55
service protocol.

runtime/vm/service/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ class @Code extends @Object {
22282228
CodeKind kind;
22292229
22302230
// This code object's corresponding function.
2231-
@Function function [optional];
2231+
@Function|NativeFunction function [optional];
22322232
}
22332233
```
22342234

@@ -2243,7 +2243,7 @@ class Code extends Object {
22432243
CodeKind kind;
22442244
22452245
// This code object's corresponding function.
2246-
@Function function [optional];
2246+
@Function|NativeFunction function [optional];
22472247
}
22482248
```
22492249

0 commit comments

Comments
 (0)