Skip to content

Commit edcfbf1

Browse files
authored
Added support for some debugging APIs with the DDC library bundle format - part 4 (#2545)
* Added support for getClassMetadata with the DDc library bundle format * Added support for some debugging APIs with the DDC library bundle format. * Update pattern test to account for new DDC JS variable naming * reverting change to pattern test * Added support for debugging API with the DDC library bundle format. * updated licenses * updated licenses and remove new line from changelog * added docstring to getRecordFiledJsExpression
1 parent 6465541 commit edcfbf1

File tree

7 files changed

+56
-4
lines changed

7 files changed

+56
-4
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## 24.2.1-wip
22

33
- Update to be forward compatible with changes to `package:shelf_web_socket`.
4-
- Added support for some debugging APIs with the DDC library bundle format. - [#2537](https://github.com/dart-lang/webdev/issues/2537)
4+
- Added support for some debugging APIs with the DDC library bundle format. - [#2537](https://github.com/dart-lang/webdev/issues/2537),[#2544](https://github.com/dart-lang/webdev/issues/2544)
55

66
## 24.2.0
77

dwds/lib/src/debugging/dart_runtime_debugger.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,13 @@ class DartRuntimeDebugger {
160160
'getSetElements(this)',
161161
);
162162
}
163+
164+
/// Generates a JS expression for retrieving the fields of a record.
165+
String getRecordFieldsJsExpression() {
166+
return _buildExpression(
167+
'',
168+
'getRecordFields(this)',
169+
'getRecordFields(this)',
170+
);
171+
}
163172
}

dwds/lib/src/debugging/instance.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ class InstanceHelper extends Domain {
524524
// We do this in in awkward way because we want the keys and values, but we
525525
// can't return things by value or some Dart objects will come back as
526526
// values that we need to be RemoteObject, e.g. a List of int.
527-
final expression = _jsRuntimeFunctionCall('getRecordFields(this)');
527+
final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
528+
.getRecordFieldsJsExpression();
528529

529530
final result = await inspector.jsCallFunctionOn(record, expression, []);
530531
final fieldNameElements =

dwds/test/instances/common/record_inspection_common.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ void runTests({
6666
verboseCompiler: debug,
6767
experiments: ['records', 'patterns'],
6868
canaryFeatures: canaryFeatures,
69+
moduleFormat: provider.ddcModuleFormat,
6970
),
7071
);
7172
service = context.debugConnection.vmService;

dwds/test/instances/record_inspection_canary_test.dart renamed to dwds/test/instances/record_inspection_amd_canary_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

@@ -7,6 +7,7 @@
77
@Timeout(Duration(minutes: 2))
88
library;
99

10+
import 'package:dwds/src/services/expression_compiler.dart';
1011
import 'package:test/test.dart';
1112
import 'package:test_common/test_sdk_configuration.dart';
1213

@@ -22,6 +23,7 @@ void main() {
2223
final provider = TestSdkConfigurationProvider(
2324
verbose: debug,
2425
canaryFeatures: canaryFeatures,
26+
ddcModuleFormat: ModuleFormat.amd,
2527
);
2628
tearDownAll(provider.dispose);
2729

dwds/test/instances/record_inspection_test.dart renamed to dwds/test/instances/record_inspection_amd_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

@@ -7,6 +7,7 @@
77
@Timeout(Duration(minutes: 2))
88
library;
99

10+
import 'package:dwds/src/services/expression_compiler.dart';
1011
import 'package:test/test.dart';
1112
import 'package:test_common/test_sdk_configuration.dart';
1213

@@ -22,6 +23,7 @@ void main() {
2223
final provider = TestSdkConfigurationProvider(
2324
verbose: debug,
2425
canaryFeatures: canaryFeatures,
26+
ddcModuleFormat: ModuleFormat.amd,
2527
);
2628
tearDownAll(provider.dispose);
2729

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
@Tags(['daily'])
6+
@TestOn('vm')
7+
@Timeout(Duration(minutes: 2))
8+
library;
9+
10+
import 'package:dwds/src/services/expression_compiler.dart';
11+
import 'package:test/test.dart';
12+
import 'package:test_common/test_sdk_configuration.dart';
13+
14+
import '../fixtures/context.dart';
15+
import 'common/record_inspection_common.dart';
16+
17+
void main() {
18+
// Enable verbose logging for debugging.
19+
final debug = false;
20+
final canaryFeatures = true;
21+
final compilationMode = CompilationMode.frontendServer;
22+
23+
group('canary: $canaryFeatures |', () {
24+
final provider = TestSdkConfigurationProvider(
25+
verbose: debug,
26+
canaryFeatures: canaryFeatures,
27+
ddcModuleFormat: ModuleFormat.ddc,
28+
);
29+
tearDownAll(provider.dispose);
30+
runTests(
31+
provider: provider,
32+
compilationMode: compilationMode,
33+
canaryFeatures: canaryFeatures,
34+
debug: debug,
35+
);
36+
});
37+
}

0 commit comments

Comments
 (0)