From 26747805eb7a1b422b8cef67e11f156c2d6435c8 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:34:09 -0700 Subject: [PATCH 1/4] Ignore undefined values --- dwds/lib/src/debugging/dart_scope.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwds/lib/src/debugging/dart_scope.dart b/dwds/lib/src/debugging/dart_scope.dart index f929d971b..efd53aba6 100644 --- a/dwds/lib/src/debugging/dart_scope.dart +++ b/dwds/lib/src/debugging/dart_scope.dart @@ -67,6 +67,8 @@ Future> visibleProperties({ if (value == null) return true; final type = value.type; + if (type == 'undefined') return true; + final description = value.description ?? ''; final name = property.name ?? ''; From f3c76f5c90f92c8a5cb2b0c22b362df582cd1f35 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:26:25 -0700 Subject: [PATCH 2/4] Add test cases --- .../instances/patterns_inspection_test.dart | 24 +++++++++++++++++++ fixtures/_experimentSound/web/main.dart | 9 +++++++ 2 files changed, 33 insertions(+) diff --git a/dwds/test/instances/patterns_inspection_test.dart b/dwds/test/instances/patterns_inspection_test.dart index c5f91deac..5f5a2892a 100644 --- a/dwds/test/instances/patterns_inspection_test.dart +++ b/dwds/test/instances/patterns_inspection_test.dart @@ -156,6 +156,30 @@ Future _runTests({ previousLocation = location; } }); + + test('before instantiation of pattern-matching variables', () async { + await onBreakPoint('testPattern2Case1', (event) async { + final frame = event.topFrame!; + + expect(await getFrameVariables(frame), { + 'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo') + }); + }); + }); + + test('after instantiation of pattern-matching variables', () async { + await onBreakPoint('testPattern2Case2', (event) async { + final frame = event.topFrame!; + + expect(await getFrameVariables(frame), { + 'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo'), + 'cats': matchListInstance(type: 'List'), + 'firstCat': + matchPrimitiveInstance(kind: 'String', value: 'Garfield'), + 'secondCat': matchPrimitiveInstance(kind: 'String', value: 'Tom'), + }); + }); + }); }); }, // TODO(annagrin): Remove when dart 3.0 is stable. skip: semver.Version.parse(Platform.version.split(' ')[0]) < diff --git a/fixtures/_experimentSound/web/main.dart b/fixtures/_experimentSound/web/main.dart index 1c34887e8..07ba289e0 100644 --- a/fixtures/_experimentSound/web/main.dart +++ b/fixtures/_experimentSound/web/main.dart @@ -19,6 +19,7 @@ void main() { testPattern(['a', 1]); testPattern([3.14, 'b']); testPattern([0, 1]); + testPattern2(); }); document.body!.appendText('Program is running!'); @@ -64,3 +65,11 @@ String testPattern(Object obj) { return 'default'; // Breakpoint: testPatternDefault } } + +String testPattern2() { + final dog = 'Prismo'; + final cats = ['Garfield', 'Tom']; // Breakpoint: testPattern2Case1 + final [firstCat, secondCat] = cats; + print(firstCat); // Breakpoint: testPattern2Case2 + return '$dog, $firstCat, $secondCat'; +} From a6c6c18775bf4ba8b3c6e8a524f883c6f108222a Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 30 Mar 2023 15:19:47 -0700 Subject: [PATCH 3/4] Wrong closing brackets --- .../instances/patterns_inspection_test.dart | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/dwds/test/instances/patterns_inspection_test.dart b/dwds/test/instances/patterns_inspection_test.dart index 5f5a2892a..87ee1083d 100644 --- a/dwds/test/instances/patterns_inspection_test.dart +++ b/dwds/test/instances/patterns_inspection_test.dart @@ -156,28 +156,27 @@ Future _runTests({ previousLocation = location; } }); + }); - test('before instantiation of pattern-matching variables', () async { - await onBreakPoint('testPattern2Case1', (event) async { - final frame = event.topFrame!; + test('before instantiation of pattern-matching variables', () async { + await onBreakPoint('testPattern2Case1', (event) async { + final frame = event.topFrame!; - expect(await getFrameVariables(frame), { - 'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo') - }); - }); + expect(await getFrameVariables(frame), + {'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo')}); }); + }); - test('after instantiation of pattern-matching variables', () async { - await onBreakPoint('testPattern2Case2', (event) async { - final frame = event.topFrame!; - - expect(await getFrameVariables(frame), { - 'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo'), - 'cats': matchListInstance(type: 'List'), - 'firstCat': - matchPrimitiveInstance(kind: 'String', value: 'Garfield'), - 'secondCat': matchPrimitiveInstance(kind: 'String', value: 'Tom'), - }); + test('after instantiation of pattern-matching variables', () async { + await onBreakPoint('testPattern2Case2', (event) async { + final frame = event.topFrame!; + + expect(await getFrameVariables(frame), { + 'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo'), + 'cats': matchListInstance(type: 'List'), + 'firstCat': + matchPrimitiveInstance(kind: 'String', value: 'Garfield'), + 'secondCat': matchPrimitiveInstance(kind: 'String', value: 'Tom'), }); }); }); From b7e4d7e90fdf4de2a7072e68a0d7b7c0bd3cf986 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 30 Mar 2023 15:26:17 -0700 Subject: [PATCH 4/4] Merge in master --- dwds/test/instances/patterns_inspection_test.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dwds/test/instances/patterns_inspection_test.dart b/dwds/test/instances/patterns_inspection_test.dart index 87ee1083d..1aa2eb891 100644 --- a/dwds/test/instances/patterns_inspection_test.dart +++ b/dwds/test/instances/patterns_inspection_test.dart @@ -162,8 +162,10 @@ Future _runTests({ await onBreakPoint('testPattern2Case1', (event) async { final frame = event.topFrame!; - expect(await getFrameVariables(frame), - {'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo')}); + expect( + await getFrameVariables(frame), + {'dog': matchPrimitiveInstance(kind: 'String', value: 'Prismo')}, + ); }); });