Skip to content

Commit b139649

Browse files
authored
Don't show non-instantiated variables (#2061)
1 parent 8437f60 commit b139649

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

dwds/lib/src/debugging/dart_scope.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Future<List<Property>> visibleProperties({
6767
if (value == null) return true;
6868

6969
final type = value.type;
70+
if (type == 'undefined') return true;
71+
7072
final description = value.description ?? '';
7173
final name = property.name ?? '';
7274

dwds/test/instances/patterns_inspection_test.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,31 @@ Future<void> _runTests({
157157
}
158158
});
159159
});
160+
161+
test('before instantiation of pattern-matching variables', () async {
162+
await onBreakPoint('testPattern2Case1', (event) async {
163+
final frame = event.topFrame!;
164+
165+
expect(
166+
await getFrameVariables(frame),
167+
{'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo')},
168+
);
169+
});
170+
});
171+
172+
test('after instantiation of pattern-matching variables', () async {
173+
await onBreakPoint('testPattern2Case2', (event) async {
174+
final frame = event.topFrame!;
175+
176+
expect(await getFrameVariables(frame), {
177+
'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo'),
178+
'cats': matchListInstance(type: 'List<String>'),
179+
'firstCat':
180+
matchPrimitiveInstance(kind: 'String', value: 'Garfield'),
181+
'secondCat': matchPrimitiveInstance(kind: 'String', value: 'Tom'),
182+
});
183+
});
184+
});
160185
}, // TODO(annagrin): Remove when dart 3.0 is stable.
161186
skip: semver.Version.parse(Platform.version.split(' ')[0]) <
162187
semver.Version.parse('3.0.0-351.0.dev'),

fixtures/_experimentSound/web/main.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void main() {
1919
testPattern(['a', 1]);
2020
testPattern([3.14, 'b']);
2121
testPattern([0, 1]);
22+
testPattern2();
2223
});
2324

2425
document.body!.appendText('Program is running!');
@@ -64,3 +65,11 @@ String testPattern(Object obj) {
6465
return 'default'; // Breakpoint: testPatternDefault
6566
}
6667
}
68+
69+
String testPattern2() {
70+
final dog = 'Prismo';
71+
final cats = ['Garfield', 'Tom']; // Breakpoint: testPattern2Case1
72+
final [firstCat, secondCat] = cats;
73+
print(firstCat); // Breakpoint: testPattern2Case2
74+
return '$dog, $firstCat, $secondCat';
75+
}

0 commit comments

Comments
 (0)