[ VM / Service ] Move sourceLocation property to reference objects for Class, Function, and Field.

Token position and script reference information are cheap to provide and
make it possible to tie objects to scripts without requiring additional
requests for full objects.

TEST=Existing

Change-Id: I917714149a72a53081fee5626ccad858e86f5313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201864
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ben Konyi 2021-06-02 22:18:32 +00:00 committed by commit-bot@chromium.org
parent 40856c14c1
commit fa5da6a944
19 changed files with 387 additions and 224 deletions

2
DEPS
View file

@ -107,7 +107,7 @@ vars = {
"chromedriver_tag": "83.0.4103.39", "chromedriver_tag": "83.0.4103.39",
"dartdoc_rev" : "305713608c25106d95f9114418d895e08d1a9e9c", "dartdoc_rev" : "305713608c25106d95f9114418d895e08d1a9e9c",
"devtools_rev" : "e138d55437a59838607415ef21f20bd6c4955dbc", "devtools_rev" : "b3bf672474a2bff82f33e1176aa803539baa0d60+1",
"jsshell_tag": "version:88.0", "jsshell_tag": "version:88.0",
"ffi_rev": "f3346299c55669cc0db48afae85b8110088bf8da", "ffi_rev": "f3346299c55669cc0db48afae85b8110088bf8da",
"fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba", "fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba",

View file

@ -1,4 +1,9 @@
# Changelog # Changelog
## 7.1.0
- Update to version `3.46` of the spec.
- Move `sourcePosition` properties into `ClassRef`, `FieldRef`, and `FuncRef`.
## 7.0.0 ## 7.0.0
- *breaking bug fix*: Fixed issue where response parsing could fail for `Context`. - *breaking bug fix*: Fixed issue where response parsing could fail for `Context`.
- Add support for `setBreakpointState` RPC and updated `Breakpoint` class to include - Add support for `setBreakpointState` RPC and updated `Breakpoint` class to include

View file

@ -317,6 +317,7 @@ vms.ClassRef assertClassRef(vms.ClassRef obj) {
assertNotNull(obj); assertNotNull(obj);
assertString(obj.id!); assertString(obj.id!);
assertString(obj.name!); assertString(obj.name!);
assertLibraryRef(obj.library!);
return obj; return obj;
} }
@ -331,10 +332,10 @@ vms.Class assertClass(vms.Class obj) {
assertNotNull(obj); assertNotNull(obj);
assertString(obj.id!); assertString(obj.id!);
assertString(obj.name!); assertString(obj.name!);
assertLibraryRef(obj.library!);
assertBool(obj.isAbstract!); assertBool(obj.isAbstract!);
assertBool(obj.isConst!); assertBool(obj.isConst!);
assertBool(obj.traceAllocations!); assertBool(obj.traceAllocations!);
assertLibraryRef(obj.library!);
assertListOfInstanceRef(obj.interfaces!); assertListOfInstanceRef(obj.interfaces!);
assertListOfFieldRef(obj.fields!); assertListOfFieldRef(obj.fields!);
assertListOfFuncRef(obj.functions!); assertListOfFuncRef(obj.functions!);

View file

@ -1 +1 @@
version=3.45 version=3.46

View file

@ -485,7 +485,7 @@ class HttpProfileRequestData {
HttpProfileRequestData.buildErrorRequest({ HttpProfileRequestData.buildErrorRequest({
required this.error, required this.error,
required this.events, required this.events,
}) : _connectionInfo = null, }) : _connectionInfo = null,
_contentLength = null, _contentLength = null,
_cookies = [], _cookies = [],
_followRedirects = null, _followRedirects = null,

View file

@ -26,7 +26,7 @@ export 'snapshot_graph.dart'
HeapSnapshotObjectNoData, HeapSnapshotObjectNoData,
HeapSnapshotObjectNullData; HeapSnapshotObjectNullData;
const String vmServiceVersion = '3.45.0'; const String vmServiceVersion = '3.46.0';
/// @optional /// @optional
const String optional = 'optional'; const String optional = 'optional';
@ -2690,8 +2690,8 @@ class AllocationProfile extends Response {
as List? ?? as List? ??
[]); []);
memoryUsage = memoryUsage =
createServiceObject(json['memoryUsage']!, const ['MemoryUsage']) createServiceObject(json['memoryUsage'], const ['MemoryUsage'])
as MemoryUsage; as MemoryUsage?;
dateLastAccumulatorReset = json['dateLastAccumulatorReset'] is String dateLastAccumulatorReset = json['dateLastAccumulatorReset'] is String
? int.parse(json['dateLastAccumulatorReset']) ? int.parse(json['dateLastAccumulatorReset'])
: json['dateLastAccumulatorReset']; : json['dateLastAccumulatorReset'];
@ -2743,9 +2743,9 @@ class BoundField {
}); });
BoundField._fromJson(Map<String, dynamic> json) { BoundField._fromJson(Map<String, dynamic> json) {
decl = createServiceObject(json['decl']!, const ['FieldRef']) as FieldRef; decl = createServiceObject(json['decl'], const ['FieldRef']) as FieldRef?;
value = value =
createServiceObject(json['value']!, const ['InstanceRef', 'Sentinel']) createServiceObject(json['value'], const ['InstanceRef', 'Sentinel'])
as dynamic; as dynamic;
} }
@ -2800,7 +2800,7 @@ class BoundVariable extends Response {
BoundVariable._fromJson(Map<String, dynamic> json) : super._fromJson(json) { BoundVariable._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
value = createServiceObject(json['value']!, value = createServiceObject(json['value'],
const ['InstanceRef', 'TypeArgumentsRef', 'Sentinel']) as dynamic; const ['InstanceRef', 'TypeArgumentsRef', 'Sentinel']) as dynamic;
declarationTokenPos = json['declarationTokenPos'] ?? -1; declarationTokenPos = json['declarationTokenPos'] ?? -1;
scopeStartTokenPos = json['scopeStartTokenPos'] ?? -1; scopeStartTokenPos = json['scopeStartTokenPos'] ?? -1;
@ -2875,7 +2875,7 @@ class Breakpoint extends Obj {
enabled = json['enabled'] ?? false; enabled = json['enabled'] ?? false;
resolved = json['resolved'] ?? false; resolved = json['resolved'] ?? false;
isSyntheticAsyncContinuation = json['isSyntheticAsyncContinuation']; isSyntheticAsyncContinuation = json['isSyntheticAsyncContinuation'];
location = createServiceObject(json['location']!, location = createServiceObject(json['location'],
const ['SourceLocation', 'UnresolvedSourceLocation']) as dynamic; const ['SourceLocation', 'UnresolvedSourceLocation']) as dynamic;
} }
@ -2914,15 +2914,28 @@ class ClassRef extends ObjRef {
/// The name of this class. /// The name of this class.
String? name; String? name;
/// The location of this class in the source code.
@optional
SourceLocation? location;
/// The library which contains this class.
LibraryRef? library;
ClassRef({ ClassRef({
required this.name, required this.name,
required this.library,
required String id, required String id,
this.location,
}) : super( }) : super(
id: id, id: id,
); );
ClassRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) { ClassRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?;
library = createServiceObject(json['library'], const ['LibraryRef'])
as LibraryRef?;
} }
@override @override
@ -2934,7 +2947,9 @@ class ClassRef extends ObjRef {
json['type'] = type; json['type'] = type;
json.addAll({ json.addAll({
'name': name, 'name': name,
'library': library?.toJson(),
}); });
_setIfNotNull(json, 'location', location?.toJson());
return json; return json;
} }
@ -2942,7 +2957,8 @@ class ClassRef extends ObjRef {
operator ==(other) => other is ClassRef && id == other.id; operator ==(other) => other is ClassRef && id == other.id;
String toString() => '[ClassRef id: ${id}, name: ${name}]'; String toString() =>
'[ClassRef id: ${id}, name: ${name}, library: ${library}]';
} }
/// A `Class` provides information about a Dart language class. /// A `Class` provides information about a Dart language class.
@ -2953,6 +2969,13 @@ class Class extends Obj implements ClassRef {
/// The name of this class. /// The name of this class.
String? name; String? name;
/// The location of this class in the source code.
@optional
SourceLocation? location;
/// The library which contains this class.
LibraryRef? library;
/// The error which occurred during class finalization, if it exists. /// The error which occurred during class finalization, if it exists.
@optional @optional
ErrorRef? error; ErrorRef? error;
@ -2966,13 +2989,6 @@ class Class extends Obj implements ClassRef {
/// Are allocations of this class being traced? /// Are allocations of this class being traced?
bool? traceAllocations; bool? traceAllocations;
/// The library which contains this class.
LibraryRef? library;
/// The location of this class in the source code.
@optional
SourceLocation? location;
/// The superclass of this class, if any. /// The superclass of this class, if any.
@optional @optional
ClassRef? superClass; ClassRef? superClass;
@ -3006,17 +3022,17 @@ class Class extends Obj implements ClassRef {
Class({ Class({
required this.name, required this.name,
required this.library,
required this.isAbstract, required this.isAbstract,
required this.isConst, required this.isConst,
required this.traceAllocations, required this.traceAllocations,
required this.library,
required this.interfaces, required this.interfaces,
required this.fields, required this.fields,
required this.functions, required this.functions,
required this.subclasses, required this.subclasses,
required String id, required String id,
this.error,
this.location, this.location,
this.error,
this.superClass, this.superClass,
this.superType, this.superType,
this.mixin, this.mixin,
@ -3026,14 +3042,14 @@ class Class extends Obj implements ClassRef {
Class._fromJson(Map<String, dynamic> json) : super._fromJson(json) { Class._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?;
library = createServiceObject(json['library'], const ['LibraryRef'])
as LibraryRef?;
error = createServiceObject(json['error'], const ['ErrorRef']) as ErrorRef?; error = createServiceObject(json['error'], const ['ErrorRef']) as ErrorRef?;
isAbstract = json['abstract'] ?? false; isAbstract = json['abstract'] ?? false;
isConst = json['const'] ?? false; isConst = json['const'] ?? false;
traceAllocations = json['traceAllocations'] ?? false; traceAllocations = json['traceAllocations'] ?? false;
library = createServiceObject(json['library']!, const ['LibraryRef'])
as LibraryRef;
location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?;
superClass = superClass =
createServiceObject(json['super'], const ['ClassRef']) as ClassRef?; createServiceObject(json['super'], const ['ClassRef']) as ClassRef?;
superType = createServiceObject(json['superType'], const ['InstanceRef']) superType = createServiceObject(json['superType'], const ['InstanceRef'])
@ -3063,17 +3079,17 @@ class Class extends Obj implements ClassRef {
json['type'] = type; json['type'] = type;
json.addAll({ json.addAll({
'name': name, 'name': name,
'library': library?.toJson(),
'abstract': isAbstract, 'abstract': isAbstract,
'const': isConst, 'const': isConst,
'traceAllocations': traceAllocations, 'traceAllocations': traceAllocations,
'library': library?.toJson(),
'interfaces': interfaces?.map((f) => f.toJson()).toList(), 'interfaces': interfaces?.map((f) => f.toJson()).toList(),
'fields': fields?.map((f) => f.toJson()).toList(), 'fields': fields?.map((f) => f.toJson()).toList(),
'functions': functions?.map((f) => f.toJson()).toList(), 'functions': functions?.map((f) => f.toJson()).toList(),
'subclasses': subclasses?.map((f) => f.toJson()).toList(), 'subclasses': subclasses?.map((f) => f.toJson()).toList(),
}); });
_setIfNotNull(json, 'error', error?.toJson());
_setIfNotNull(json, 'location', location?.toJson()); _setIfNotNull(json, 'location', location?.toJson());
_setIfNotNull(json, 'error', error?.toJson());
_setIfNotNull(json, 'super', superClass?.toJson()); _setIfNotNull(json, 'super', superClass?.toJson());
_setIfNotNull(json, 'superType', superType?.toJson()); _setIfNotNull(json, 'superType', superType?.toJson());
_setIfNotNull(json, 'mixin', mixin?.toJson()); _setIfNotNull(json, 'mixin', mixin?.toJson());
@ -3118,7 +3134,7 @@ class ClassHeapStats extends Response {
ClassHeapStats._fromJson(Map<String, dynamic> json) : super._fromJson(json) { ClassHeapStats._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
classRef = classRef =
createServiceObject(json['class']!, const ['ClassRef']) as ClassRef; createServiceObject(json['class'], const ['ClassRef']) as ClassRef?;
accumulatedSize = json['accumulatedSize'] ?? -1; accumulatedSize = json['accumulatedSize'] ?? -1;
bytesCurrent = json['bytesCurrent'] ?? -1; bytesCurrent = json['bytesCurrent'] ?? -1;
instancesAccumulated = json['instancesAccumulated'] ?? -1; instancesAccumulated = json['instancesAccumulated'] ?? -1;
@ -3378,7 +3394,7 @@ class ContextElement {
ContextElement._fromJson(Map<String, dynamic> json) { ContextElement._fromJson(Map<String, dynamic> json) {
value = value =
createServiceObject(json['value']!, const ['InstanceRef', 'Sentinel']) createServiceObject(json['value'], const ['InstanceRef', 'Sentinel'])
as dynamic; as dynamic;
} }
@ -4015,6 +4031,10 @@ class FieldRef extends ObjRef {
/// Is this field static? /// Is this field static?
bool? isStatic; bool? isStatic;
/// The location of this field in the source code.
@optional
SourceLocation? location;
FieldRef({ FieldRef({
required this.name, required this.name,
required this.owner, required this.owner,
@ -4023,19 +4043,22 @@ class FieldRef extends ObjRef {
required this.isFinal, required this.isFinal,
required this.isStatic, required this.isStatic,
required String id, required String id,
this.location,
}) : super( }) : super(
id: id, id: id,
); );
FieldRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) { FieldRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
owner = createServiceObject(json['owner']!, const ['ObjRef']) as ObjRef; owner = createServiceObject(json['owner'], const ['ObjRef']) as ObjRef?;
declaredType = declaredType =
createServiceObject(json['declaredType']!, const ['InstanceRef']) createServiceObject(json['declaredType'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
isConst = json['const'] ?? false; isConst = json['const'] ?? false;
isFinal = json['final'] ?? false; isFinal = json['final'] ?? false;
isStatic = json['static'] ?? false; isStatic = json['static'] ?? false;
location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?;
} }
@override @override
@ -4053,6 +4076,7 @@ class FieldRef extends ObjRef {
'final': isFinal, 'final': isFinal,
'static': isStatic, 'static': isStatic,
}); });
_setIfNotNull(json, 'location', location?.toJson());
return json; return json;
} }
@ -4091,6 +4115,10 @@ class Field extends Obj implements FieldRef {
/// Is this field static? /// Is this field static?
bool? isStatic; bool? isStatic;
/// The location of this field in the source code.
@optional
SourceLocation? location;
/// The value of this field, if the field is static. If uninitialized, this /// The value of this field, if the field is static. If uninitialized, this
/// will take the value of an uninitialized Sentinel. /// will take the value of an uninitialized Sentinel.
/// ///
@ -4098,10 +4126,6 @@ class Field extends Obj implements FieldRef {
@optional @optional
dynamic staticValue; dynamic staticValue;
/// The location of this field in the source code.
@optional
SourceLocation? location;
Field({ Field({
required this.name, required this.name,
required this.owner, required this.owner,
@ -4110,25 +4134,25 @@ class Field extends Obj implements FieldRef {
required this.isFinal, required this.isFinal,
required this.isStatic, required this.isStatic,
required String id, required String id,
this.staticValue,
this.location, this.location,
this.staticValue,
}) : super( }) : super(
id: id, id: id,
); );
Field._fromJson(Map<String, dynamic> json) : super._fromJson(json) { Field._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
owner = createServiceObject(json['owner']!, const ['ObjRef']) as ObjRef; owner = createServiceObject(json['owner'], const ['ObjRef']) as ObjRef?;
declaredType = declaredType =
createServiceObject(json['declaredType']!, const ['InstanceRef']) createServiceObject(json['declaredType'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
isConst = json['const'] ?? false; isConst = json['const'] ?? false;
isFinal = json['final'] ?? false; isFinal = json['final'] ?? false;
isStatic = json['static'] ?? false; isStatic = json['static'] ?? false;
staticValue = createServiceObject(
json['staticValue'], const ['InstanceRef', 'Sentinel']) as dynamic;
location = createServiceObject(json['location'], const ['SourceLocation']) location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?; as SourceLocation?;
staticValue = createServiceObject(
json['staticValue'], const ['InstanceRef', 'Sentinel']) as dynamic;
} }
@override @override
@ -4146,8 +4170,8 @@ class Field extends Obj implements FieldRef {
'final': isFinal, 'final': isFinal,
'static': isStatic, 'static': isStatic,
}); });
_setIfNotNull(json, 'staticValue', staticValue?.toJson());
_setIfNotNull(json, 'location', location?.toJson()); _setIfNotNull(json, 'location', location?.toJson());
_setIfNotNull(json, 'staticValue', staticValue?.toJson());
return json; return json;
} }
@ -4328,12 +4352,17 @@ class FuncRef extends ObjRef {
/// Is this function const? /// Is this function const?
bool? isConst; bool? isConst;
/// The location of this function in the source code.
@optional
SourceLocation? location;
FuncRef({ FuncRef({
required this.name, required this.name,
required this.owner, required this.owner,
required this.isStatic, required this.isStatic,
required this.isConst, required this.isConst,
required String id, required String id,
this.location,
}) : super( }) : super(
id: id, id: id,
); );
@ -4341,9 +4370,11 @@ class FuncRef extends ObjRef {
FuncRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) { FuncRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
owner = createServiceObject( owner = createServiceObject(
json['owner']!, const ['LibraryRef', 'ClassRef', 'FuncRef']) as dynamic; json['owner'], const ['LibraryRef', 'ClassRef', 'FuncRef']) as dynamic;
isStatic = json['static'] ?? false; isStatic = json['static'] ?? false;
isConst = json['const'] ?? false; isConst = json['const'] ?? false;
location = createServiceObject(json['location'], const ['SourceLocation'])
as SourceLocation?;
} }
@override @override
@ -4359,6 +4390,7 @@ class FuncRef extends ObjRef {
'static': isStatic, 'static': isStatic,
'const': isConst, 'const': isConst,
}); });
_setIfNotNull(json, 'location', location?.toJson());
return json; return json;
} }
@ -4413,7 +4445,7 @@ class Func extends Obj implements FuncRef {
Func._fromJson(Map<String, dynamic> json) : super._fromJson(json) { Func._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'] ?? ''; name = json['name'] ?? '';
owner = createServiceObject( owner = createServiceObject(
json['owner']!, const ['LibraryRef', 'ClassRef', 'FuncRef']) as dynamic; json['owner'], const ['LibraryRef', 'ClassRef', 'FuncRef']) as dynamic;
isStatic = json['static'] ?? false; isStatic = json['static'] ?? false;
isConst = json['const'] ?? false; isConst = json['const'] ?? false;
location = createServiceObject(json['location'], const ['SourceLocation']) location = createServiceObject(json['location'], const ['SourceLocation'])
@ -4600,7 +4632,7 @@ class InstanceRef extends ObjRef {
kind = json['kind'] ?? ''; kind = json['kind'] ?? '';
identityHashCode = json['identityHashCode'] ?? -1; identityHashCode = json['identityHashCode'] ?? -1;
classRef = classRef =
createServiceObject(json['class']!, const ['ClassRef']) as ClassRef; createServiceObject(json['class'], const ['ClassRef']) as ClassRef?;
valueAsString = json['valueAsString']; valueAsString = json['valueAsString'];
valueAsStringIsTruncated = json['valueAsStringIsTruncated']; valueAsStringIsTruncated = json['valueAsStringIsTruncated'];
length = json['length']; length = json['length'];
@ -4984,7 +5016,7 @@ class Instance extends Obj implements InstanceRef {
kind = json['kind'] ?? ''; kind = json['kind'] ?? '';
identityHashCode = json['identityHashCode'] ?? -1; identityHashCode = json['identityHashCode'] ?? -1;
classRef = classRef =
createServiceObject(json['class']!, const ['ClassRef']) as ClassRef; createServiceObject(json['class'], const ['ClassRef']) as ClassRef?;
valueAsString = json['valueAsString']; valueAsString = json['valueAsString'];
valueAsStringIsTruncated = json['valueAsStringIsTruncated']; valueAsStringIsTruncated = json['valueAsStringIsTruncated'];
length = json['length']; length = json['length'];
@ -5250,7 +5282,7 @@ class Isolate extends Response implements IsolateRef {
livePorts = json['livePorts'] ?? -1; livePorts = json['livePorts'] ?? -1;
pauseOnExit = json['pauseOnExit'] ?? false; pauseOnExit = json['pauseOnExit'] ?? false;
pauseEvent = pauseEvent =
createServiceObject(json['pauseEvent']!, const ['Event']) as Event; createServiceObject(json['pauseEvent'], const ['Event']) as Event?;
rootLib = createServiceObject(json['rootLib'], const ['LibraryRef']) rootLib = createServiceObject(json['rootLib'], const ['LibraryRef'])
as LibraryRef?; as LibraryRef?;
libraries = List<LibraryRef>.from( libraries = List<LibraryRef>.from(
@ -5519,7 +5551,7 @@ class InboundReference {
}); });
InboundReference._fromJson(Map<String, dynamic> json) { InboundReference._fromJson(Map<String, dynamic> json) {
source = createServiceObject(json['source']!, const ['ObjRef']) as ObjRef; source = createServiceObject(json['source'], const ['ObjRef']) as ObjRef?;
parentListIndex = json['parentListIndex']; parentListIndex = json['parentListIndex'];
parentField = createServiceObject(json['parentField'], const ['FieldRef']) parentField = createServiceObject(json['parentField'], const ['FieldRef'])
as FieldRef?; as FieldRef?;
@ -5744,8 +5776,8 @@ class LibraryDependency {
isImport = json['isImport'] ?? false; isImport = json['isImport'] ?? false;
isDeferred = json['isDeferred'] ?? false; isDeferred = json['isDeferred'] ?? false;
prefix = json['prefix'] ?? ''; prefix = json['prefix'] ?? '';
target = createServiceObject(json['target']!, const ['LibraryRef']) target = createServiceObject(json['target'], const ['LibraryRef'])
as LibraryRef; as LibraryRef?;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -5807,19 +5839,19 @@ class LogRecord extends Response {
}); });
LogRecord._fromJson(Map<String, dynamic> json) : super._fromJson(json) { LogRecord._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
message = createServiceObject(json['message']!, const ['InstanceRef']) message = createServiceObject(json['message'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
time = json['time'] ?? -1; time = json['time'] ?? -1;
level = json['level'] ?? -1; level = json['level'] ?? -1;
sequenceNumber = json['sequenceNumber'] ?? -1; sequenceNumber = json['sequenceNumber'] ?? -1;
loggerName = createServiceObject(json['loggerName']!, const ['InstanceRef']) loggerName = createServiceObject(json['loggerName'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
zone = createServiceObject(json['zone']!, const ['InstanceRef']) zone = createServiceObject(json['zone'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
error = createServiceObject(json['error']!, const ['InstanceRef']) error = createServiceObject(json['error'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
stackTrace = createServiceObject(json['stackTrace']!, const ['InstanceRef']) stackTrace = createServiceObject(json['stackTrace'], const ['InstanceRef'])
as InstanceRef; as InstanceRef?;
} }
@override @override
@ -5861,10 +5893,10 @@ class MapAssociation {
}); });
MapAssociation._fromJson(Map<String, dynamic> json) { MapAssociation._fromJson(Map<String, dynamic> json) {
key = createServiceObject(json['key']!, const ['InstanceRef', 'Sentinel']) key = createServiceObject(json['key'], const ['InstanceRef', 'Sentinel'])
as dynamic; as dynamic;
value = value =
createServiceObject(json['value']!, const ['InstanceRef', 'Sentinel']) createServiceObject(json['value'], const ['InstanceRef', 'Sentinel'])
as dynamic; as dynamic;
} }
@ -6051,6 +6083,11 @@ class NullValRef extends InstanceRef {
kind: InstanceKind.kNull, kind: InstanceKind.kNull,
classRef: ClassRef( classRef: ClassRef(
id: 'class/null', id: 'class/null',
library: LibraryRef(
id: '',
name: 'dart:core',
uri: 'dart:core',
),
name: 'Null', name: 'Null',
), ),
); );
@ -6098,6 +6135,11 @@ class NullVal extends Instance implements NullValRef {
kind: InstanceKind.kNull, kind: InstanceKind.kNull,
classRef: ClassRef( classRef: ClassRef(
id: 'class/null', id: 'class/null',
library: LibraryRef(
id: '',
name: 'dart:core',
uri: 'dart:core',
),
name: 'Null', name: 'Null',
), ),
); );
@ -6323,7 +6365,7 @@ class ProfileFunction {
exclusiveTicks = json['exclusiveTicks'] ?? -1; exclusiveTicks = json['exclusiveTicks'] ?? -1;
resolvedUrl = json['resolvedUrl'] ?? ''; resolvedUrl = json['resolvedUrl'] ?? '';
function = function =
createServiceObject(json['function']!, const ['dynamic']) as dynamic; createServiceObject(json['function'], const ['dynamic']) as dynamic;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -6433,8 +6475,8 @@ class ProcessMemoryUsage extends Response {
ProcessMemoryUsage._fromJson(Map<String, dynamic> json) ProcessMemoryUsage._fromJson(Map<String, dynamic> json)
: super._fromJson(json) { : super._fromJson(json) {
root = createServiceObject(json['root']!, const ['ProcessMemoryItem']) root = createServiceObject(json['root'], const ['ProcessMemoryItem'])
as ProcessMemoryItem; as ProcessMemoryItem?;
} }
@override @override
@ -6562,7 +6604,7 @@ class RetainingObject {
}); });
RetainingObject._fromJson(Map<String, dynamic> json) { RetainingObject._fromJson(Map<String, dynamic> json) {
value = createServiceObject(json['value']!, const ['ObjRef']) as ObjRef; value = createServiceObject(json['value'], const ['ObjRef']) as ObjRef?;
parentListIndex = json['parentListIndex']; parentListIndex = json['parentListIndex'];
parentMapKey = parentMapKey =
createServiceObject(json['parentMapKey'], const ['ObjRef']) as ObjRef?; createServiceObject(json['parentMapKey'], const ['ObjRef']) as ObjRef?;
@ -6810,8 +6852,8 @@ class Script extends Obj implements ScriptRef {
Script._fromJson(Map<String, dynamic> json) : super._fromJson(json) { Script._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
uri = json['uri'] ?? ''; uri = json['uri'] ?? '';
library = createServiceObject(json['library']!, const ['LibraryRef']) library = createServiceObject(json['library'], const ['LibraryRef'])
as LibraryRef; as LibraryRef?;
lineOffset = json['lineOffset']; lineOffset = json['lineOffset'];
columnOffset = json['columnOffset']; columnOffset = json['columnOffset'];
source = json['source']; source = json['source'];
@ -6932,7 +6974,7 @@ class SourceLocation extends Response {
SourceLocation._fromJson(Map<String, dynamic> json) : super._fromJson(json) { SourceLocation._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
script = script =
createServiceObject(json['script']!, const ['ScriptRef']) as ScriptRef; createServiceObject(json['script'], const ['ScriptRef']) as ScriptRef?;
tokenPos = json['tokenPos'] ?? -1; tokenPos = json['tokenPos'] ?? -1;
endTokenPos = json['endTokenPos']; endTokenPos = json['endTokenPos'];
} }
@ -7235,7 +7277,7 @@ class Timeline extends Response {
static Timeline? parse(Map<String, dynamic>? json) => static Timeline? parse(Map<String, dynamic>? json) =>
json == null ? null : Timeline._fromJson(json); json == null ? null : Timeline._fromJson(json);
/// A list of timeline events. No order is guarenteed for these events; in /// A list of timeline events. No order is guaranteed for these events; in
/// particular, these events may be unordered with respect to their /// particular, these events may be unordered with respect to their
/// timestamps. /// timestamps.
List<TimelineEvent>? traceEvents; List<TimelineEvent>? traceEvents;

View file

@ -3,7 +3,7 @@ description: >-
A library to communicate with a service implementing the Dart VM A library to communicate with a service implementing the Dart VM
service protocol. service protocol.
version: 7.0.0 version: 7.1.0
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service

View file

@ -1491,6 +1491,8 @@ class Type extends Member {
gen.writeln('identityHashCode: 0,'); gen.writeln('identityHashCode: 0,');
gen.writeln('kind: InstanceKind.kNull,'); gen.writeln('kind: InstanceKind.kNull,');
gen.writeln("classRef: ClassRef(id: 'class/null',"); gen.writeln("classRef: ClassRef(id: 'class/null',");
gen.writeln("library: LibraryRef(id: '', name: 'dart:core',");
gen.writeln("uri: 'dart:core',),");
gen.writeln("name: 'Null',),"); gen.writeln("name: 'Null',),");
gen.writeln(')'); gen.writeln(')');
} }
@ -1640,10 +1642,9 @@ class Type extends Member {
} }
} else { } else {
String typesList = _typeRefListToString(field.type.types); String typesList = _typeRefListToString(field.type.types);
String nullable = String nullable = field.type.name != 'dynamic' ? '?' : '';
field.optional && field.type.name != 'dynamic' ? '?' : '';
gen.writeln("${field.generatableName} = " gen.writeln("${field.generatableName} = "
"createServiceObject(json['${field.name}']${field.optional ? '' : '!'}, " "createServiceObject(json['${field.name}'], "
"$typesList) as ${field.type.name}$nullable;"); "$typesList) as ${field.type.name}$nullable;");
} }
}); });

View file

@ -4755,8 +4755,8 @@ void _upgradeCollection(collection, ServiceObjectOwner? owner) {
void _upgradeMap(Map map, ServiceObjectOwner? owner) { void _upgradeMap(Map map, ServiceObjectOwner? owner) {
map.forEach((k, v) { map.forEach((k, v) {
if ((v is Map) && _isServiceMap(v)) { if ((v is Map) && owner != null && _isServiceMap(v)) {
map[k] = owner!.getFromMap(v); map[k] = owner.getFromMap(v);
} else if (v is List) { } else if (v is List) {
_upgradeList(v, owner); _upgradeList(v, owner);
} else if (v is Map) { } else if (v is Map) {

View file

@ -12,7 +12,7 @@ var tests = <VMTest>[
final result = await vm.invokeRpcNoUpgrade('getVersion', {}); final result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], 'Version'); expect(result['type'], 'Version');
expect(result['major'], 3); expect(result['major'], 3);
expect(result['minor'], 45); expect(result['minor'], 46);
expect(result['_privateMajor'], 0); expect(result['_privateMajor'], 0);
expect(result['_privateMinor'], 0); expect(result['_privateMinor'], 0);
}, },

View file

@ -4765,7 +4765,7 @@ void _upgradeCollection(collection, ServiceObjectOwner owner) {
void _upgradeMap(Map map, ServiceObjectOwner owner) { void _upgradeMap(Map map, ServiceObjectOwner owner) {
map.forEach((k, v) { map.forEach((k, v) {
if ((v is Map) && _isServiceMap(v)) { if ((v is Map) && owner != null && _isServiceMap(v)) {
map[k] = owner.getFromMap(v); map[k] = owner.getFromMap(v);
} else if (v is List) { } else if (v is List) {
_upgradeList(v, owner); _upgradeList(v, owner);

View file

@ -12,7 +12,7 @@ var tests = <VMTest>[
var result = await vm.invokeRpcNoUpgrade('getVersion', {}); var result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], equals('Version')); expect(result['type'], equals('Version'));
expect(result['major'], equals(3)); expect(result['major'], equals(3));
expect(result['minor'], equals(45)); expect(result['minor'], equals(46));
expect(result['_privateMajor'], equals(0)); expect(result['_privateMajor'], equals(0));
expect(result['_privateMinor'], equals(0)); expect(result['_privateMinor'], equals(0));
}, },

View file

@ -171,23 +171,24 @@ ISOLATE_UNIT_TEST_CASE(JSON_JSONStream_DartObject) {
} }
char buffer[1024]; char buffer[1024];
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("objects", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"[{\"type\":\"@Instance\"," "[{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
"\"_vmType\":\"null\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
"\"name\":\"Null\"}," "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
"\"kind\":\"Null\"," "kind\":\"kernel\"},\"tokenPos\":925,\"endTokenPos\":1165},\"library\":{"
"\"fixedId\":true," "\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
"\"id\":\"objects\\/null\"," "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
"\"valueAsString\":\"null\"}," "\"id\":\"\",\"valueAsString\":\"null\"},{\"object_key\":{\"type\":\"@"
"{\"object_key\":" "Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@Class\","
"{\"type\":\"@Instance\"," "\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
"\"_vmType\":\"null\"," "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_kind\":\"kernel\"},"
"\"name\":\"Null\"}," "\"tokenPos\":925,\"endTokenPos\":1165},\"library\":{\"type\":\"@"
"\"kind\":\"Null\"," "Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":"
"\"fixedId\":true," "\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,\"id\":\"\","
"\"id\":\"objects\\/null\","
"\"valueAsString\":\"null\"}}]", "\"valueAsString\":\"null\"}}]",
buffer); buffer);
} }

View file

@ -87,6 +87,13 @@ void Class::PrintJSONImpl(JSONStream* stream, bool ref) const {
const String& scrubbed_name = String::Handle(ScrubbedName()); const String& scrubbed_name = String::Handle(ScrubbedName());
const String& vm_name = String::Handle(Name()); const String& vm_name = String::Handle(Name());
AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString()); AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString());
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos(), end_token_pos());
}
jsobj.AddProperty("library", Object::Handle(library()));
if (ref) { if (ref) {
return; return;
} }
@ -116,11 +123,6 @@ void Class::PrintJSONImpl(JSONStream* stream, bool ref) const {
mix ^= interface_array.At(interface_array.Length() - 1); mix ^= interface_array.At(interface_array.Length() - 1);
jsobj.AddProperty("mixin", mix); jsobj.AddProperty("mixin", mix);
} }
jsobj.AddProperty("library", Object::Handle(library()));
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos(), end_token_pos());
}
{ {
JSONArray interfaces_array(&jsobj, "interfaces"); JSONArray interfaces_array(&jsobj, "interfaces");
Type& interface_type = Type::Handle(); Type& interface_type = Type::Handle();
@ -317,6 +319,12 @@ void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("const", is_const()); jsobj.AddProperty("const", is_const());
jsobj.AddProperty("_intrinsic", is_intrinsic()); jsobj.AddProperty("_intrinsic", is_intrinsic());
jsobj.AddProperty("_native", is_native()); jsobj.AddProperty("_native", is_native());
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos(), end_token_pos());
}
if (ref) { if (ref) {
return; return;
} }
@ -348,11 +356,6 @@ void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("_field", field); jsobj.AddProperty("_field", field);
} }
} }
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos(), end_token_pos());
}
} }
void FfiTrampolineData::PrintJSONImpl(JSONStream* stream, bool ref) const { void FfiTrampolineData::PrintJSONImpl(JSONStream* stream, bool ref) const {
@ -390,6 +393,12 @@ void Field::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("static", is_static()); jsobj.AddProperty("static", is_static());
jsobj.AddProperty("final", is_final()); jsobj.AddProperty("final", is_final());
jsobj.AddProperty("const", is_const()); jsobj.AddProperty("const", is_const());
const class Script& script = Script::Handle(Script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos(), end_token_pos());
}
if (ref) { if (ref) {
return; return;
} }
@ -416,10 +425,6 @@ void Field::PrintJSONImpl(JSONStream* stream, bool ref) const {
} else { } else {
jsobj.AddPropertyF("_guardLength", "%" Pd, guarded_list_length()); jsobj.AddPropertyF("_guardLength", "%" Pd, guarded_list_length());
} }
const class Script& script = Script::Handle(Script());
if (!script.IsNull()) {
jsobj.AddLocation(script, token_pos());
}
} }
// See also Dart_ScriptGetTokenInfo. // See also Dart_ScriptGetTokenInfo.

View file

@ -4344,8 +4344,16 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
Class& cls = Class::Handle(isolate->group()->object_store()->bool_class()); Class& cls = Class::Handle(isolate->group()->object_store()->bool_class());
cls.PrintJSON(&js, true); cls.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("libraries", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\"}", "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
"\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":\"@"
"Script\","
"\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
"\"_kind\":\"kernel\"},\"tokenPos\":436,\"endTokenPos\":4432},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"dart.core\",\"uri\":\"dart:core\"}}",
buffer); buffer);
} }
// Function reference // Function reference
@ -4359,14 +4367,23 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
ASSERT(!func.IsNull()); ASSERT(!func.IsNull());
func.PrintJSON(&js, true); func.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("libraries", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Function\",\"fixedId\":true," "{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
"\"id\":\"\",\"name\":\"toString\"," "\"name\":\"toString\",\"owner\":{\"type\":\"@Class\","
"\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
"\"name\":\"bool\"}," "\"location\":{\"type\":\"SourceLocation\","
"\"_kind\":\"RegularFunction\"," "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"static\":false,\"const\":false," "\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
"\"_intrinsic\":false,\"_native\":false}", "\"_kind\":\"kernel\"},\"tokenPos\":436,\"endTokenPos\":4432},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"_kind\":\"RegularFunction\",\"static\":false,\"const\":false,"
"\"_intrinsic\":false,\"_native\":false,"
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
"\"uri\":\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"},"
"\"tokenPos\":4372,\"endTokenPos\":4430}}",
buffer); buffer);
} }
// Library reference // Library reference
@ -4386,15 +4403,17 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
JSONStream js; JSONStream js;
Bool::True().PrintJSON(&js, true); Bool::True().PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("libraries", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Bool\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Bool\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\",\"location\":{"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
"\"name\":\"bool\"}," "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\",\"_"
"\"identityHashCode\":0," "kind\":\"kernel\"},\"tokenPos\":436,\"endTokenPos\":4432},\"library\":"
"\"kind\":\"Bool\"," "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
"\"fixedId\":true," "core\",\"uri\":\"dart:core\"}},\"identityHashCode\":0,\"kind\":"
"\"id\":\"objects\\/bool-true\",\"valueAsString\":\"true\"}", "\"Bool\",\"fixedId\":true,\"id\":\"objects\\/bool-true\","
"\"valueAsString\":\"true\"}",
buffer); buffer);
} }
// Smi reference // Smi reference
@ -4404,16 +4423,17 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
smi.PrintJSON(&js, true); smi.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("_Smi@", buffer, buffer); ElideJSONSubstring("_Smi@", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Smi\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Smi\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Smi\",\"_vmName\":"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
"\"name\":\"_Smi\"," "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"\"_vmName\":\"\"}," "patch\\/integers.dart\",\"_kind\":\"kernel\"},\"tokenPos\":16466,"
"\"identityHashCode\":0," "\"endTokenPos\":24948},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"\"kind\":\"Int\"," "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"fixedId\":true," "\"identityHashCode\":0,\"kind\":\"Int\",\"fixedId\":true,\"id\":"
"\"id\":\"objects\\/int-7\",\"valueAsString\":\"7\"}", "\"objects\\/int-7\",\"valueAsString\":\"7\"}",
buffer); buffer);
} }
// Mint reference // Mint reference
@ -4423,15 +4443,18 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
smi.PrintJSON(&js, true); smi.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_Mint@", buffer, buffer); ElideJSONSubstring("_Mint@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Mint\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Mint\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Mint\",\"_vmName\":"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
"\"name\":\"_Mint\",\"_vmName\":\"\"}," "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"\"identityHashCode\":0," "patch\\/integers.dart\",\"_kind\":\"kernel\"},\"tokenPos\":25029,"
"\"kind\":\"Int\"," "\"endTokenPos\":25413},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"\"id\":\"\",\"valueAsString\":\"-9223372036854775808\"}", "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"identityHashCode\":0,\"kind\":\"Int\",\"id\":\"\",\"valueAsString\":"
"\"-9223372036854775808\"}",
buffer); buffer);
} }
// Double reference // Double reference
@ -4441,15 +4464,18 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
dub.PrintJSON(&js, true); dub.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_Double@", buffer, buffer); ElideJSONSubstring("_Double@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Double\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Double\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Double\",\"_vmName\":"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
"\"name\":\"_Double\",\"_vmName\":\"\"}," "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"\"identityHashCode\":0," "patch\\/double.dart\",\"_kind\":\"kernel\"},\"tokenPos\":248,"
"\"kind\":\"Double\"," "\"endTokenPos\":12248},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"\"id\":\"\",\"valueAsString\":\"0.1234\"}", "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"identityHashCode\":0,\"kind\":\"Double\",\"id\":\"\","
"\"valueAsString\":\"0.1234\"}",
buffer); buffer);
} }
// String reference // String reference
@ -4459,15 +4485,18 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
str.PrintJSON(&js, true); str.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_OneByteString@", buffer, buffer); ElideJSONSubstring("_OneByteString@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"String\",\"class\":{\"type\":\"@"
"\"_vmType\":\"String\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_OneByteString\",\"_"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
"\"name\":\"_OneByteString\",\"_vmName\":\"\"}," "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"\"identityHashCode\":0," "patch\\/string_patch.dart\",\"_kind\":\"kernel\"},\"tokenPos\":32310,"
"\"kind\":\"String\"," "\"endTokenPos\":44332},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"\"id\":\"\",\"length\":2,\"valueAsString\":\"dw\"}", "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"identityHashCode\":0,\"kind\":\"String\",\"id\":\"\",\"length\":2,"
"\"valueAsString\":\"dw\"}",
buffer); buffer);
} }
// Array reference // Array reference
@ -4477,15 +4506,17 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
array.PrintJSON(&js, true); array.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_List@", buffer, buffer); ElideJSONSubstring("_List@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Array\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Array\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_List\",\"_vmName\":"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
"\"name\":\"_List\",\"_vmName\":\"\"}," "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"\"identityHashCode\":0," "patch\\/array.dart\",\"_kind\":\"kernel\"},\"tokenPos\":248,"
"\"kind\":\"List\"," "\"endTokenPos\":7758},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"\"id\":\"\",\"length\":0}", "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"identityHashCode\":0,\"kind\":\"List\",\"id\":\"\",\"length\":0}",
buffer); buffer);
} }
// GrowableObjectArray reference // GrowableObjectArray reference
@ -4496,16 +4527,18 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
array.PrintJSON(&js, true); array.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_GrowableList@", buffer, buffer); ElideJSONSubstring("_GrowableList@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"GrowableObjectArray\",\"class\":"
"\"_vmType\":\"GrowableObjectArray\"," "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "GrowableList\",\"_vmName\":\"\",\"location\":{\"type\":"
"\"name\":\"_GrowableList\"," "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"_vmName\":\"\"}," "\"id\":\"\",\"uri\":\"dart:core-patch\\/growable_array.dart\",\"_"
"\"identityHashCode\":0," "kind\":\"kernel\"},\"tokenPos\":248,\"endTokenPos\":18485},"
"\"kind\":\"List\"," "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
"\"id\":\"\",\"length\":0}", "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"identityHashCode\":0,"
"\"kind\":\"List\",\"id\":\"\",\"length\":0}",
buffer); buffer);
} }
// LinkedHashMap reference // LinkedHashMap reference
@ -4516,15 +4549,18 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
array.PrintJSON(&js, true); array.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_InternalLinkedHashMap@", buffer, buffer); ElideJSONSubstring("_InternalLinkedHashMap@", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"LinkedHashMap\",\"class\":{"
"\"_vmType\":\"LinkedHashMap\"," "\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "InternalLinkedHashMap\",\"_vmName\":\"\",\"location\":{\"type\":"
"\"name\":\"_InternalLinkedHashMap\",\"_vmName\":\"\"}," "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"identityHashCode\":0," "\"id\":\"\",\"uri\":\"dart:collection-patch\\/"
"\"kind\":\"Map\"," "compact_hash.dart\",\"_kind\":\"kernel\"},\"tokenPos\":6399,"
"\"id\":\"\"," "\"endTokenPos\":6786},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"true,\"id\":\"\",\"name\":\"dart.collection\",\"uri\":\"dart:"
"collection\"}},\"identityHashCode\":0,\"kind\":\"Map\",\"id\":\"\","
"\"length\":0}", "\"length\":0}",
buffer); buffer);
} }
@ -4535,12 +4571,17 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
tag.PrintJSON(&js, true); tag.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_UserTag@", buffer, buffer); ElideJSONSubstring("_UserTag@", buffer, buffer);
EXPECT_SUBSTRING( EXPECT_SUBSTRING(
"{\"type\":\"@Instance\"," "\"type\":\"@Instance\",\"_vmType\":\"UserTag\",\"class\":{\"type\":\"@"
"\"_vmType\":\"UserTag\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_UserTag\",\"_"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
"\"name\":\"_UserTag\",\"_vmName\":\"\"}," "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
"developer-patch\\/profiler.dart\",\"_kind\":\"kernel\"},\"tokenPos\":"
"414,\"endTokenPos\":672},\"library\":{\"type\":\"@Library\","
"\"fixedId\":true,\"id\":\"\",\"name\":\"dart.developer\",\"uri\":"
"\"dart:developer\"}},"
// Handle non-zero identity hash. // Handle non-zero identity hash.
"\"identityHashCode\":", "\"identityHashCode\":",
buffer); buffer);
@ -4558,12 +4599,16 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
type.PrintJSON(&js, true); type.PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("objects", buffer, buffer); ElideJSONSubstring("objects", buffer, buffer);
ElideJSONSubstring("libraries", buffer, buffer);
ElideJSONSubstring("_Type@", buffer, buffer); ElideJSONSubstring("_Type@", buffer, buffer);
EXPECT_SUBSTRING( EXPECT_SUBSTRING(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"Type\",\"class\":{\"type\":\"@"
"\"_vmType\":\"Type\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Type\",\"_vmName\":"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
"\"name\":\"_Type\",\"_vmName\":\"\"}," "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"patch\\/type_patch.dart\",\"_kind\":\"kernel\"},\"tokenPos\":493,"
"\"endTokenPos\":898},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
// Handle non-zero identity hash. // Handle non-zero identity hash.
"\"identityHashCode\":", "\"identityHashCode\":",
buffer); buffer);
@ -4571,7 +4616,12 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
"\"kind\":\"Type\"," "\"kind\":\"Type\","
"\"fixedId\":true,\"id\":\"\"," "\"fixedId\":true,\"id\":\"\","
"\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"bool\"},\"name\":\"bool\"}", "\"name\":\"bool\",\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":"
"\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"},\"tokenPos\":436,"
"\"endTokenPos\":4432},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"name\":\"bool\"}",
buffer); buffer);
} }
// Null reference // Null reference
@ -4579,15 +4629,16 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
JSONStream js; JSONStream js;
Object::null_object().PrintJSON(&js, true); Object::null_object().PrintJSON(&js, true);
ElideJSONSubstring("classes", js.ToCString(), buffer); ElideJSONSubstring("classes", js.ToCString(), buffer);
ElideJSONSubstring("libraries", buffer, buffer);
EXPECT_STREQ( EXPECT_STREQ(
"{\"type\":\"@Instance\"," "{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
"\"_vmType\":\"null\"," "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
"\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
"\"name\":\"Null\"}," "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
"\"kind\":\"Null\"," "kind\":\"kernel\"},\"tokenPos\":925,\"endTokenPos\":1165},\"library\":"
"\"fixedId\":true," "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
"\"id\":\"objects\\/null\"," "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
"\"valueAsString\":\"null\"}", "\"id\":\"objects\\/null\",\"valueAsString\":\"null\"}",
buffer); buffer);
} }
// Sentinel reference // Sentinel reference

View file

@ -15,7 +15,7 @@
namespace dart { namespace dart {
#define SERVICE_PROTOCOL_MAJOR_VERSION 3 #define SERVICE_PROTOCOL_MAJOR_VERSION 3
#define SERVICE_PROTOCOL_MINOR_VERSION 45 #define SERVICE_PROTOCOL_MINOR_VERSION 46
class Array; class Array;
class EmbedderServiceHandler; class EmbedderServiceHandler;

View file

@ -1,8 +1,8 @@
# Dart VM Service Protocol 3.45 # Dart VM Service Protocol 3.46
> Please post feedback to the [observatory-discuss group][discuss-list] > Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 3.45_ of the Dart VM Service Protocol. This This document describes of _version 3.46_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine. protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag. To use the Service Protocol, start the VM with the *--observe* flag.
@ -1687,6 +1687,12 @@ been loaded (i.e. a deferred library).
class @Class extends @Object { class @Class extends @Object {
// The name of this class. // The name of this class.
string name; string name;
// The location of this class in the source code.
SourceLocation location [optional];
// The library which contains this class.
@Library library;
} }
``` ```
@ -1697,6 +1703,12 @@ class Class extends Object {
// The name of this class. // The name of this class.
string name; string name;
// The location of this class in the source code.
SourceLocation location [optional];
// The library which contains this class.
@Library library;
// The error which occurred during class finalization, if it exists. // The error which occurred during class finalization, if it exists.
@Error error [optional]; @Error error [optional];
@ -1709,12 +1721,6 @@ class Class extends Object {
// Are allocations of this class being traced? // Are allocations of this class being traced?
bool traceAllocations; bool traceAllocations;
// The library which contains this class.
@Library library;
// The location of this class in the source code.
SourceLocation location [optional];
// The superclass of this class, if any. // The superclass of this class, if any.
@Class super [optional]; @Class super [optional];
@ -2298,6 +2304,9 @@ class @Field extends @Object {
// Is this field static? // Is this field static?
bool static; bool static;
// The location of this field in the source code.
SourceLocation location [optional];
} }
``` ```
@ -2327,12 +2336,12 @@ class Field extends Object {
// Is this field static? // Is this field static?
bool static; bool static;
// The location of this field in the source code.
SourceLocation location [optional];
// The value of this field, if the field is static. If uninitialized, // The value of this field, if the field is static. If uninitialized,
// this will take the value of an uninitialized Sentinel. // this will take the value of an uninitialized Sentinel.
@Instance|Sentinel staticValue [optional]; @Instance|Sentinel staticValue [optional];
// The location of this field in the source code.
SourceLocation location [optional];
} }
``` ```
@ -2401,6 +2410,9 @@ class @Function extends @Object {
// Is this function const? // Is this function const?
bool const; bool const;
// The location of this function in the source code.
SourceLocation location [optional];
} }
``` ```
@ -4038,5 +4050,6 @@ version | comments
3.43 | Updated heap snapshot format to include identity hash codes. Added `getAllocationTraces` and `setTraceClassAllocation` RPCs, updated `CpuSample` to include `identityHashCode` and `classId` properties, updated `Class` to include `traceAllocations` property. 3.43 | Updated heap snapshot format to include identity hash codes. Added `getAllocationTraces` and `setTraceClassAllocation` RPCs, updated `CpuSample` to include `identityHashCode` and `classId` properties, updated `Class` to include `traceAllocations` property.
3.44 | Added `identityHashCode` property to `@Instance` and `Instance`. 3.44 | Added `identityHashCode` property to `@Instance` and `Instance`.
3.45 | Added `setBreakpointState` RPC and `BreakpointUpdated` event kind. 3.45 | Added `setBreakpointState` RPC and `BreakpointUpdated` event kind.
3.46 | Moved `sourceLocation` property into reference types for `Class`, `Field`, and `Function`.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss

View file

@ -501,7 +501,10 @@ ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_SimpleCall) {
"\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true," "\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}," "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"},"
"\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false," "\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false,"
"\"_intrinsic\":false,\"_native\":false},\"count\":1}]}]}]," "\"_intrinsic\":false,\"_native\":false,\"location\":{\"type\":"
"\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"},"
"\"tokenPos\":0,\"endTokenPos\":11}},\"count\":1}]}]}],"
// One script in the script table. // One script in the script table.
"\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
@ -510,7 +513,7 @@ ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_SimpleCall) {
} }
ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_PolymorphicCall) { ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
char buffer[1024]; char buffer[4096];
const char* kScript = const char* kScript =
"class Common {\n" "class Common {\n"
" func() {}\n" " func() {}\n"
@ -553,27 +556,65 @@ ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
// First receiver: "Common", called twice. // First receiver: "Common", called twice.
"{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"Common\"}," "\"name\":\"Common\","
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\","
"\"fixedId\":true,\"id\":\"\","
"\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":0,\"endTokenPos\":27},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}},"
"\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\"," "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"func\"," "\"name\":\"func\","
"\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"Common\"},\"_kind\":\"RegularFunction\"," "\"name\":\"Common\","
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\","
"\"fixedId\":true,\"id\":\"\","
"\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":0,\"endTokenPos\":27},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}"
"},\"_kind\":\"RegularFunction\","
"\"static\":false,\"const\":false,\"_intrinsic\":false," "\"static\":false,\"const\":false,\"_intrinsic\":false,"
"\"_native\":false}," "\"_native\":false,"
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":17,\"endTokenPos\":25}},"
"\"count\":2}," "\"count\":2},"
// Second receiver: "Uncommon", called once. // Second receiver: "Uncommon", called once.
"{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"Uncommon\"}," "\"name\":\"Uncommon\","
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\","
"\"fixedId\":true,\"id\":\"\","
"\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":29,\"endTokenPos\":58},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}},"
"\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\"," "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"func\"," "\"name\":\"func\","
"\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\"," "\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"Uncommon\"},\"_kind\":\"RegularFunction\"," "\"name\":\"Uncommon\","
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\","
"\"fixedId\":true,\"id\":\"\","
"\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":29,\"endTokenPos\":58},"
"\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}"
"},\"_kind\":\"RegularFunction\","
"\"static\":false,\"const\":false,\"_intrinsic\":false," "\"static\":false,\"const\":false,\"_intrinsic\":false,"
"\"_native\":false}," "\"_native\":false,"
"\"location\":{\"type\":\"SourceLocation\","
"\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\","
"\"_kind\":\"kernel\"},\"tokenPos\":48,\"endTokenPos\":56}},"
"\"count\":1}]}]}]," "\"count\":1}]}]}],"
@ -584,7 +625,7 @@ ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
} }
ISOLATE_UNIT_TEST_CASE(SourceReport_MultipleReports) { ISOLATE_UNIT_TEST_CASE(SourceReport_MultipleReports) {
char buffer[1024]; char buffer[2048];
const char* kScript = const char* kScript =
"helper0() {}\n" "helper0() {}\n"
"helper1() {}\n" "helper1() {}\n"
@ -614,16 +655,18 @@ ISOLATE_UNIT_TEST_CASE(SourceReport_MultipleReports) {
// One range not compiled (helper1). // One range not compiled (helper1).
"{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false}," "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false},"
// One range compiled with one callsite (main). // One range compiled with one callsite (main)m
"{\"scriptIndex\":0,\"startPos\":26,\"endPos\":48,\"compiled\":true," "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":48,\"compiled\":true,"
"\"callSites\":[" "\"callSites\":[{\"name\":\"helper0\",\"tokenPos\":37,\"cacheEntries\":[{"
"{\"name\":\"helper0\",\"tokenPos\":37,\"cacheEntries\":[" "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
"{\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
"\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true," "\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true,"
"\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}," "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"},\"_"
"\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false," "kind\":\"RegularFunction\",\"static\":true,\"const\":false,\"_"
"\"_intrinsic\":false,\"_native\":false},\"count\":1}]}]," "intrinsic\":false,\"_native\":false,\"location\":{\"type\":"
"\"coverage\":{\"hits\":[26,37],\"misses\":[]}}]," "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
"\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"},"
"\"tokenPos\":0,\"endTokenPos\":11}},\"count\":1}]}],\"coverage\":{"
"\"hits\":[26,37],\"misses\":[]}}],"
// One script in the script table. // One script in the script table.
"\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","

View file

@ -36,5 +36,6 @@ cipd create \
-name dart/third_party/flutter/devtools \ -name dart/third_party/flutter/devtools \
-in cipd_package \ -in cipd_package \
-install-mode copy \ -install-mode copy \
-preserve-writable \
-tag git_revision:$1 -tag git_revision:$1