Skip to content

Commit

Permalink
[observatory] Fix _guardLength serialization to output a string, rath…
Browse files Browse the repository at this point in the history
…er than an int.

Change-Id: I12e3505649ebe9bb72f479dc7e2fc2dd19226ed7
Reviewed-on: https://dart-review.googlesource.com/68802
Reviewed-by: Ryan Macnak <rmacnak@google.com>
  • Loading branch information
aam committed Aug 7, 2018
1 parent 1f44496 commit 6bdf3b7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions runtime/observatory/tests/service/get_object_rpc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'test_helper.dart';

class _DummyClass {
static var dummyVar = 11;
final List<String> dummyList = new List<String>(20);
void dummyFunction() {}
}

Expand Down Expand Up @@ -884,6 +885,27 @@ var tests = <IsolateTest>[
expect(result['_guardLength'], isNotNull);
},

// field
(Isolate isolate) async {
// Call eval to get a class id.
var evalResult = await eval(isolate, 'new _DummyClass()');
var id = "${evalResult['class']['id']}/fields/dummyList";
var params = {
'objectId': id,
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Field'));
expect(result['id'], equals(id));
expect(result['name'], equals('dummyList'));
expect(result['const'], equals(false));
expect(result['static'], equals(false));
expect(result['final'], equals(true));
expect(result['location']['type'], equals('SourceLocation'));
expect(result['_guardNullable'], isNotNull);
expect(result['_guardClass'], isNotNull);
expect(result['_guardLength'], equals('20'));
},

// invalid field.
(Isolate isolate) async {
// Call eval to get a class id.
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/object_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ void Field::PrintJSONImpl(JSONStream* stream, bool ref) const {
} else if (guarded_list_length() == kNoFixedLength) {
jsobj.AddProperty("_guardLength", "variable");
} else {
jsobj.AddProperty("_guardLength", guarded_list_length());
jsobj.AddPropertyF("_guardLength", "%" Pd, guarded_list_length());
}
const class Script& script = Script::Handle(Script());
if (!script.IsNull()) {
Expand Down

0 comments on commit 6bdf3b7

Please sign in to comment.