Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into dwds2421
Browse files Browse the repository at this point in the history
  • Loading branch information
srujzs committed Dec 18, 2024
2 parents c9245e2 + edcfbf1 commit c47093e
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Update to be forward compatible with changes to `package:shelf_web_socket`.
- Added support for some debugging APIs with the DDC library bundle format. - [#2537](https://github.com/dart-lang/webdev/issues/2537)
- 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)
- Expose a partial implementation of
`FrontendServerDdcLibraryBundleStrategyProvider`.
- Update `package:vm_service_interface` to '^2.0.1'.
Expand Down
9 changes: 9 additions & 0 deletions dwds/lib/src/debugging/dart_runtime_debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,13 @@ class DartRuntimeDebugger {
'getSetElements(this)',
);
}

/// Generates a JS expression for retrieving the fields of a record.
String getRecordFieldsJsExpression() {
return _buildExpression(
'',
'getRecordFields(this)',
'getRecordFields(this)',
);
}
}
3 changes: 2 additions & 1 deletion dwds/lib/src/debugging/instance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ class InstanceHelper extends Domain {
// We do this in in awkward way because we want the keys and values, but we
// can't return things by value or some Dart objects will come back as
// values that we need to be RemoteObject, e.g. a List of int.
final expression = _jsRuntimeFunctionCall('getRecordFields(this)');
final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
.getRecordFieldsJsExpression();

final result = await inspector.jsCallFunctionOn(record, expression, []);
final fieldNameElements =
Expand Down
1 change: 1 addition & 0 deletions dwds/test/instances/common/record_inspection_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void runTests({
verboseCompiler: debug,
experiments: ['records', 'patterns'],
canaryFeatures: canaryFeatures,
moduleFormat: provider.ddcModuleFormat,
),
);
service = context.debugConnection.vmService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

Expand All @@ -7,6 +7,7 @@
@Timeout(Duration(minutes: 2))
library;

import 'package:dwds/src/services/expression_compiler.dart';
import 'package:test/test.dart';
import 'package:test_common/test_sdk_configuration.dart';

Expand All @@ -22,6 +23,7 @@ void main() {
final provider = TestSdkConfigurationProvider(
verbose: debug,
canaryFeatures: canaryFeatures,
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

Expand All @@ -7,6 +7,7 @@
@Timeout(Duration(minutes: 2))
library;

import 'package:dwds/src/services/expression_compiler.dart';
import 'package:test/test.dart';
import 'package:test_common/test_sdk_configuration.dart';

Expand All @@ -22,6 +23,7 @@ void main() {
final provider = TestSdkConfigurationProvider(
verbose: debug,
canaryFeatures: canaryFeatures,
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);

Expand Down
37 changes: 37 additions & 0 deletions dwds/test/instances/record_inspection_ddc_library_bundle_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

@Tags(['daily'])
@TestOn('vm')
@Timeout(Duration(minutes: 2))
library;

import 'package:dwds/src/services/expression_compiler.dart';
import 'package:test/test.dart';
import 'package:test_common/test_sdk_configuration.dart';

import '../fixtures/context.dart';
import 'common/record_inspection_common.dart';

void main() {
// Enable verbose logging for debugging.
final debug = false;
final canaryFeatures = true;
final compilationMode = CompilationMode.frontendServer;

group('canary: $canaryFeatures |', () {
final provider = TestSdkConfigurationProvider(
verbose: debug,
canaryFeatures: canaryFeatures,
ddcModuleFormat: ModuleFormat.ddc,
);
tearDownAll(provider.dispose);
runTests(
provider: provider,
compilationMode: compilationMode,
canaryFeatures: canaryFeatures,
debug: debug,
);
});
}

0 comments on commit c47093e

Please sign in to comment.