Skip to content

Commit b720291

Browse files
authored
Display inherited fields (#1307)
* Display inherited fields * fix test
1 parent 699fd19 commit b720291

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

dwds/lib/src/debugging/instance.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ class InstanceHelper extends Domain {
288288
//
289289
// For maps and lists it's more complicated. Treat the actual SDK versions
290290
// of these as special.
291-
// TODO(alanknight): Handle superclass fields.
292291
final fieldNameExpression = '''function() {
293292
const sdk = ${globalLoadStrategy.loadModuleSnippet}("dart_sdk");
294293
const sdk_utils = sdk.dart;
@@ -302,7 +301,9 @@ class InstanceHelper extends Domain {
302301
const privateFields = sdk_utils.getOwnPropertySymbols(fields);
303302
const nonSymbolNames = privateFields.map(sym => sym.description);
304303
const publicFieldNames = sdk_utils.getOwnPropertyNames(fields);
305-
return nonSymbolNames.concat(publicFieldNames).join(',');
304+
const symbolNames = Object.getOwnPropertySymbols(this)
305+
.map(sym => sym.description.split('.').slice(-1)[0]);
306+
return nonSymbolNames.concat(publicFieldNames).concat(symbolNames).join(',');
306307
}
307308
''';
308309
var allNames = (await inspector

dwds/test/inspector_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void main() {
8484
properties.map((p) => p.name).where((x) => x != '__proto__').toList();
8585
var expected = [
8686
'_privateField',
87+
'abstractField',
8788
'closure',
8889
'count',
8990
'message',

dwds/test/instance_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ void main() {
141141
instance.fields.map((boundField) => boundField.decl.name).toList();
142142
expect(fieldNames, [
143143
'_privateField',
144+
'abstractField',
144145
'closure',
145146
'count',
146147
'message',

example/web/scopes_main.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// An example with more complicated scope
6-
76
import 'dart:async';
87
import 'dart:collection';
98

@@ -75,7 +74,11 @@ String libraryFunction(String arg) {
7574
return concat;
7675
}
7776

78-
class MyTestClass<T> {
77+
abstract class MyAbstractClass {
78+
String abstractField = 'abstract-field-value';
79+
}
80+
81+
class MyTestClass<T> extends MyAbstractClass {
7982
final String message;
8083

8184
String notFinal;

0 commit comments

Comments
 (0)