From a7ea61ffa07e899fe7bcb385f8cbca88427e0c0a Mon Sep 17 00:00:00 2001 From: Jessy Yameogo Date: Tue, 28 Jan 2025 13:14:24 -0500 Subject: [PATCH] Added support for getModuleLibraries with the DDC library bundle format (#2581) * 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 support for some debugging APIs with the DDC library bundle format - getRecordTypeFieldsJsExpression, callInstanceMethodJsExpression * Added support for some debugging APIs with the DDC library bundle format * updated CHANGELOG * refactored test to use common file * delete main_ddc_library_bundle.dart * fixed broken test - decoded response body to match source and renamed stack property * updated changelog * updated dart_scope to not renamed wildcard and skipped related test case * formatted test/common/chrome_proxy_service_common.dart * WIP * WIP * Added support for callLibraryMethod with the DDC library bundle format. * revert changes to callFunction * updated function name and comments * Added support for some debugging APIs with the DDC library bundle format - getModuleLibraries * reorder parameters * made arguments parameter optional * updated comment * removed comments from test/instances/instance_amd_test.dart * removed duplicate import * removed unecessary methods and branching * formatted lib/src/debugging/inspector.dart --- dwds/CHANGELOG.md | 2 +- dwds/lib/src/debugging/inspector.dart | 40 ++- .../instances/common/instance_common.dart | 304 +++++++++++------- ...est.dart => instance_amd_canary_test.dart} | 3 + ...tance_test.dart => instance_amd_test.dart} | 3 + .../instance_ddc_library_bundle_test.dart | 38 +++ fixtures/_testSound/example/scopes/main.dart | 10 + 7 files changed, 254 insertions(+), 146 deletions(-) rename dwds/test/instances/{instance_canary_test.dart => instance_amd_canary_test.dart} (90%) rename dwds/test/instances/{instance_test.dart => instance_amd_test.dart} (89%) create mode 100644 dwds/test/instances/instance_ddc_library_bundle_test.dart diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 0b25f55e2..758103c70 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,5 +1,5 @@ ## 24.3.4-wip -- Added support for some debugging APIs with the DDC library bundle format. - [#2566](https://github.com/dart-lang/webdev/issues/2566) +- Added support for some debugging APIs with the DDC library bundle format. - [#2566](https://github.com/dart-lang/webdev/issues/2566), [#2573](https://github.com/dart-lang/webdev/issues/2573) ## 24.3.3 diff --git a/dwds/lib/src/debugging/inspector.dart b/dwds/lib/src/debugging/inspector.dart index f3ae1264c..a2209ca13 100644 --- a/dwds/lib/src/debugging/inspector.dart +++ b/dwds/lib/src/debugging/inspector.dart @@ -277,9 +277,9 @@ class AppInspector implements AppInspectorInterface { @override Future invoke( String targetId, - String selector, - List arguments, - ) async { + String selector, [ + List arguments = const [], + ]) async { final remoteArguments = arguments.cast().map(remoteObjectFor).toList(); // We special case the Dart library, where invokeMethod won't work because @@ -302,14 +302,18 @@ class AppInspector implements AppInspectorInterface { String selector, List arguments, ) { + final libraryUri = library.uri; + if (libraryUri == null) { + throwInvalidParam('invoke', 'library uri is null'); + } return globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy ? _evaluateLibraryMethodWithDdcLibraryBundle( - library, + libraryUri, selector, arguments, ) : _evaluateInLibrary( - library, + libraryUri, 'function () { return this.$selector.apply(this, arguments); }', arguments, ); @@ -337,16 +341,12 @@ class AppInspector implements AppInspectorInterface { } /// Evaluate the JS function with source [jsFunction] in the context of - /// [library] with [arguments]. + /// the library identified by [libraryUri] with [arguments]. Future _evaluateInLibrary( - Library library, + String libraryUri, String jsFunction, List arguments, ) async { - final libraryUri = library.uri; - if (libraryUri == null) { - throwInvalidParam('invoke', 'library uri is null'); - } final findLibraryJsExpression = globalToolConfiguration .loadStrategy.dartRuntimeDebugger .callLibraryMethodJsExpression(libraryUri, jsFunction); @@ -355,18 +355,14 @@ class AppInspector implements AppInspectorInterface { return jsCallFunctionOn(remoteLibrary, jsFunction, arguments); } - /// Evaluates the specified top-level method [methodName] within [library] - /// using the Dart Development Compiler (DDC) library bundle strategy with - /// the given [arguments]. + /// Evaluates the specified top-level method [methodName] within the library + /// identified by [libraryUri] using the Dart Development Compiler (DDC) + /// library bundle strategy with the given optional [arguments]. Future _evaluateLibraryMethodWithDdcLibraryBundle( - Library library, - String methodName, - List arguments, - ) { - final libraryUri = library.uri; - if (libraryUri == null) { - throwInvalidParam('invoke', 'library uri is null'); - } + String libraryUri, + String methodName, [ + List arguments = const [], + ]) { final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger .callLibraryMethodJsExpression(libraryUri, methodName); return _jsCallFunction(expression, arguments); diff --git a/dwds/test/instances/common/instance_common.dart b/dwds/test/instances/common/instance_common.dart index a34c49e56..154bbebba 100644 --- a/dwds/test/instances/common/instance_common.dart +++ b/dwds/test/instances/common/instance_common.dart @@ -2,6 +2,7 @@ // 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. +import 'package:dwds/expression_compiler.dart'; import 'package:dwds/src/config/tool_configuration.dart'; import 'package:dwds/src/debugging/inspector.dart'; import 'package:test/test.dart'; @@ -107,6 +108,7 @@ void runTests({ testSettings: TestSettings( compilationMode: compilationMode, canaryFeatures: canaryFeatures, + moduleFormat: provider.ddcModuleFormat, ), ); final chromeProxyService = context.service; @@ -117,20 +119,7 @@ void runTests({ await context.tearDown(); }); - final url = 'org-dartlang-app:///example/scopes/main.dart'; - - String libraryName(CompilationMode compilationMode) => - compilationMode == CompilationMode.frontendServer - ? 'example/scopes/main.dart' - : 'example/scopes/main'; - - String libraryVariableExpression( - String variable, - CompilationMode compilationMode, - ) => - '${globalToolConfiguration.loadStrategy.loadModuleSnippet}("dart_sdk").dart.' - 'getModuleLibraries("${libraryName(compilationMode)}")' - '["$url"]["$variable"];'; + final libraryUri = 'org-dartlang-app:///example/scopes/main.dart'; String newInterceptorsExpression(String type) => 'new (require("dart_sdk")._interceptors.$type).new()'; @@ -139,22 +128,45 @@ void runTests({ /// A reference to the the variable `libraryPublicFinal`, an instance of /// `MyTestClass`. - Future libraryPublicFinal(CompilationMode compilationMode) => - inspector.jsEvaluate( - libraryVariableExpression('libraryPublicFinal', compilationMode), + Future getLibraryPublicFinalRef() => inspector.invoke( + libraryUri, + 'getLibraryPublicFinal', ); /// A reference to the the variable `libraryPublic`, a List of Strings. - Future libraryPublic(CompilationMode compilationMode) => - inspector.jsEvaluate( - libraryVariableExpression('libraryPublic', compilationMode), + Future getLibraryPublicRef() => inspector.invoke( + libraryUri, + 'getLibraryPublic', + ); + + /// A reference to the variable `map`. + Future getMapRef() => inspector.invoke( + libraryUri, + 'getMap', ); + /// A reference to the variable `identityMap`. + Future getIdentityMapRef() => inspector.invoke( + libraryUri, + 'getIdentityMap', + ); + + /// A reference to the variable `stream`. + Future getStreamRef() => inspector.invoke( + libraryUri, + 'getStream', + ); + + final unsupportedTestMsg = + 'This test is not supported with the DDC Library ' + "Bundle Format because the dartDevEmbedder doesn't let you access compiled " + 'constructors at runtime.'; + group('instanceRef', () { setUp(() => setCurrentLogWriter(debug: debug)); test('for a null', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final nullVariable = await inspector.loadField(remoteObject, 'notFinal'); final ref = await inspector.instanceRefFor(nullVariable); @@ -167,7 +179,7 @@ void runTests({ }); test('for a double', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final count = await inspector.loadField(remoteObject, 'count'); final ref = await inspector.instanceRefFor(count); expect(ref!.valueAsString, '0'); @@ -179,7 +191,7 @@ void runTests({ }); test('for an object', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final count = await inspector.loadField(remoteObject, 'myselfField'); final ref = await inspector.instanceRefFor(count); expect(ref!.kind, InstanceKind.kPlainInstance); @@ -193,7 +205,7 @@ void runTests({ }); test('for a closure', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final properties = await inspector.getProperties(remoteObject.objectId!); final closure = @@ -209,7 +221,7 @@ void runTests({ }); test('for a list', () async { - final remoteObject = await libraryPublic(compilationMode); + final remoteObject = await getLibraryPublicRef(); final ref = await inspector.instanceRefFor(remoteObject); expect(ref!.length, greaterThan(0)); expect(ref.kind, InstanceKind.kList); @@ -218,8 +230,7 @@ void runTests({ }); test('for map', () async { - final remoteObject = await inspector - .jsEvaluate(libraryVariableExpression('map', compilationMode)); + final remoteObject = await getMapRef(); final ref = await inspector.instanceRefFor(remoteObject); expect(ref!.length, 2); expect(ref.kind, InstanceKind.kMap); @@ -228,9 +239,7 @@ void runTests({ }); test('for an IdentityMap', () async { - final remoteObject = await inspector.jsEvaluate( - libraryVariableExpression('identityMap', compilationMode), - ); + final remoteObject = await getIdentityMapRef(); final ref = await inspector.instanceRefFor(remoteObject); expect(ref!.length, 2); expect(ref.kind, InstanceKind.kMap); @@ -242,9 +251,7 @@ void runTests({ test( 'for a stream', () async { - final remoteObject = await inspector.jsEvaluate( - libraryVariableExpression('stream', compilationMode), - ); + final remoteObject = await getStreamRef(); final ref = await inspector.instanceRefFor(remoteObject); expect(ref!.kind, InstanceKind.kPlainInstance); final classRef = ref.classRef!; @@ -258,54 +265,82 @@ void runTests({ skip: !dartSdkIsAtLeast('3.6.0-148.0.dev'), ); - test('for a Dart error', () async { - final remoteObject = await inspector.jsEvaluate(newDartError); - final ref = await inspector.instanceRefFor(remoteObject); - expect(ref!.kind, InstanceKind.kPlainInstance); - expect(ref.classRef!.name, 'NativeError'); - expect(inspector.isDisplayableObject(ref), isFalse); - expect(inspector.isNativeJsError(ref), isTrue); - expect(inspector.isNativeJsObject(ref), isFalse); - }); + test( + 'for a Dart error', + () async { + final remoteObject = await inspector.jsEvaluate(newDartError); + final ref = await inspector.instanceRefFor(remoteObject); + expect(ref!.kind, InstanceKind.kPlainInstance); + expect(ref.classRef!.name, 'NativeError'); + expect(inspector.isDisplayableObject(ref), isFalse); + expect(inspector.isNativeJsError(ref), isTrue); + expect(inspector.isNativeJsObject(ref), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript error', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('NativeError')); - final ref = await inspector.instanceRefFor(remoteObject); - expect(ref!.kind, InstanceKind.kPlainInstance); - expect(ref.classRef!.name, 'NativeError'); - expect(inspector.isDisplayableObject(ref), isFalse); - expect(inspector.isNativeJsError(ref), isTrue); - expect(inspector.isNativeJsObject(ref), isFalse); - }); + test( + 'for a native JavaScript error', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('NativeError')); + final ref = await inspector.instanceRefFor(remoteObject); + expect(ref!.kind, InstanceKind.kPlainInstance); + expect(ref.classRef!.name, 'NativeError'); + expect(inspector.isDisplayableObject(ref), isFalse); + expect(inspector.isNativeJsError(ref), isTrue); + expect(inspector.isNativeJsObject(ref), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript type error', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('JSNoSuchMethodError')); - final ref = await inspector.instanceRefFor(remoteObject); - expect(ref!.kind, InstanceKind.kPlainInstance); - expect(ref.classRef!.name, 'JSNoSuchMethodError'); - expect(inspector.isDisplayableObject(ref), isFalse); - expect(inspector.isNativeJsError(ref), isTrue); - expect(inspector.isNativeJsObject(ref), isFalse); - }); + test( + 'for a native JavaScript type error', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('JSNoSuchMethodError')); + final ref = await inspector.instanceRefFor(remoteObject); + expect(ref!.kind, InstanceKind.kPlainInstance); + expect(ref.classRef!.name, 'JSNoSuchMethodError'); + expect(inspector.isDisplayableObject(ref), isFalse); + expect(inspector.isNativeJsError(ref), isTrue); + expect(inspector.isNativeJsObject(ref), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript object', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('LegacyJavaScriptObject')); - final ref = await inspector.instanceRefFor(remoteObject); - expect(ref!.kind, InstanceKind.kPlainInstance); - expect(ref.classRef!.name, 'LegacyJavaScriptObject'); - expect(inspector.isDisplayableObject(ref), isFalse); - expect(inspector.isNativeJsError(ref), isFalse); - expect(inspector.isNativeJsObject(ref), isTrue); - }); + test( + 'for a native JavaScript object', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('LegacyJavaScriptObject')); + final ref = await inspector.instanceRefFor(remoteObject); + expect(ref!.kind, InstanceKind.kPlainInstance); + expect(ref.classRef!.name, 'LegacyJavaScriptObject'); + expect(inspector.isDisplayableObject(ref), isFalse); + expect(inspector.isNativeJsError(ref), isFalse); + expect(inspector.isNativeJsObject(ref), isTrue); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); }); group('instance', () { setUp(() => setCurrentLogWriter(debug: debug)); test('for an object', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final instance = await inspector.instanceFor(remoteObject); expect(instance!.kind, InstanceKind.kPlainInstance); final classRef = instance.classRef!; @@ -335,7 +370,7 @@ void runTests({ }); test('for closure', () async { - final remoteObject = await libraryPublicFinal(compilationMode); + final remoteObject = await getLibraryPublicFinalRef(); final properties = await inspector.getProperties(remoteObject.objectId!); final closure = @@ -347,7 +382,7 @@ void runTests({ }); test('for a nested object', () async { - final libraryRemoteObject = await libraryPublicFinal(compilationMode); + final libraryRemoteObject = await getLibraryPublicFinalRef(); final fieldRemoteObject = await inspector.loadField(libraryRemoteObject, 'myselfField'); final instance = await inspector.instanceFor(fieldRemoteObject); @@ -359,7 +394,7 @@ void runTests({ }); test('for a list', () async { - final remote = await libraryPublic(compilationMode); + final remote = await getLibraryPublicRef(); final instance = await inspector.instanceFor(remote); expect(instance!.kind, InstanceKind.kList); final classRef = instance.classRef!; @@ -371,8 +406,7 @@ void runTests({ }); test('for a map', () async { - final remote = await inspector - .jsEvaluate(libraryVariableExpression('map', compilationMode)); + final remote = await getMapRef(); final instance = await inspector.instanceFor(remote); expect(instance!.kind, InstanceKind.kMap); final classRef = instance.classRef!; @@ -387,9 +421,7 @@ void runTests({ }); test('for an identityMap', () async { - final remote = await inspector.jsEvaluate( - libraryVariableExpression('identityMap', compilationMode), - ); + final remote = await getIdentityMapRef(); final instance = await inspector.instanceFor(remote); expect(instance!.kind, InstanceKind.kMap); final classRef = instance.classRef!; @@ -403,9 +435,7 @@ void runTests({ test( 'for a stream', () async { - final remote = await inspector.jsEvaluate( - libraryVariableExpression('stream', compilationMode), - ); + final remote = await getStreamRef(); final instance = await inspector.instanceFor(remote); expect(instance!.kind, InstanceKind.kPlainInstance); final classRef = instance.classRef!; @@ -415,48 +445,76 @@ void runTests({ skip: !dartSdkIsAtLeast('3.6.0-148.0.dev'), ); - test('for a Dart error', () async { - final remoteObject = await inspector.jsEvaluate(newDartError); - final instance = await inspector.instanceFor(remoteObject); - expect(instance!.kind, InstanceKind.kPlainInstance); - expect(instance.classRef!.name, 'NativeError'); - expect(inspector.isDisplayableObject(instance), isFalse); - expect(inspector.isNativeJsError(instance), isTrue); - expect(inspector.isNativeJsObject(instance), isFalse); - }); + test( + 'for a Dart error', + () async { + final remoteObject = await inspector.jsEvaluate(newDartError); + final instance = await inspector.instanceFor(remoteObject); + expect(instance!.kind, InstanceKind.kPlainInstance); + expect(instance.classRef!.name, 'NativeError'); + expect(inspector.isDisplayableObject(instance), isFalse); + expect(inspector.isNativeJsError(instance), isTrue); + expect(inspector.isNativeJsObject(instance), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript error', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('NativeError')); - final instance = await inspector.instanceFor(remoteObject); - expect(instance!.kind, InstanceKind.kPlainInstance); - expect(instance.classRef!.name, 'NativeError'); - expect(inspector.isDisplayableObject(instance), isFalse); - expect(inspector.isNativeJsError(instance), isTrue); - expect(inspector.isNativeJsObject(instance), isFalse); - }); + test( + 'for a native JavaScript error', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('NativeError')); + final instance = await inspector.instanceFor(remoteObject); + expect(instance!.kind, InstanceKind.kPlainInstance); + expect(instance.classRef!.name, 'NativeError'); + expect(inspector.isDisplayableObject(instance), isFalse); + expect(inspector.isNativeJsError(instance), isTrue); + expect(inspector.isNativeJsObject(instance), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript type error', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('JSNoSuchMethodError')); - final instance = await inspector.instanceFor(remoteObject); - expect(instance!.kind, InstanceKind.kPlainInstance); - expect(instance.classRef!.name, 'JSNoSuchMethodError'); - expect(inspector.isDisplayableObject(instance), isFalse); - expect(inspector.isNativeJsError(instance), isTrue); - expect(inspector.isNativeJsObject(instance), isFalse); - }); + test( + 'for a native JavaScript type error', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('JSNoSuchMethodError')); + final instance = await inspector.instanceFor(remoteObject); + expect(instance!.kind, InstanceKind.kPlainInstance); + expect(instance.classRef!.name, 'JSNoSuchMethodError'); + expect(inspector.isDisplayableObject(instance), isFalse); + expect(inspector.isNativeJsError(instance), isTrue); + expect(inspector.isNativeJsObject(instance), isFalse); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); - test('for a native JavaScript object', () async { - final remoteObject = await inspector - .jsEvaluate(newInterceptorsExpression('LegacyJavaScriptObject')); - final instance = await inspector.instanceFor(remoteObject); - expect(instance!.kind, InstanceKind.kPlainInstance); - expect(instance.classRef!.name, 'LegacyJavaScriptObject'); - expect(inspector.isDisplayableObject(instance), isFalse); - expect(inspector.isNativeJsError(instance), isFalse); - expect(inspector.isNativeJsObject(instance), isTrue); - }); + test( + 'for a native JavaScript object', + () async { + final remoteObject = await inspector + .jsEvaluate(newInterceptorsExpression('LegacyJavaScriptObject')); + final instance = await inspector.instanceFor(remoteObject); + expect(instance!.kind, InstanceKind.kPlainInstance); + expect(instance.classRef!.name, 'LegacyJavaScriptObject'); + expect(inspector.isDisplayableObject(instance), isFalse); + expect(inspector.isNativeJsError(instance), isFalse); + expect(inspector.isNativeJsObject(instance), isTrue); + }, + skip: provider.ddcModuleFormat == ModuleFormat.ddc && + canaryFeatures == true + ? unsupportedTestMsg + : null, + ); }); }); } diff --git a/dwds/test/instances/instance_canary_test.dart b/dwds/test/instances/instance_amd_canary_test.dart similarity index 90% rename from dwds/test/instances/instance_canary_test.dart rename to dwds/test/instances/instance_amd_canary_test.dart index a3885200a..8f74aa270 100644 --- a/dwds/test/instances/instance_canary_test.dart +++ b/dwds/test/instances/instance_amd_canary_test.dart @@ -6,6 +6,7 @@ @Timeout(Duration(minutes: 2)) library; +import 'package:dwds/expression_compiler.dart'; import 'package:test/test.dart'; import 'package:test_common/test_sdk_configuration.dart'; @@ -16,11 +17,13 @@ void main() { // Enable verbose logging for debugging. final debug = false; final canaryFeatures = true; + final moduleFormat = ModuleFormat.amd; group('canary: $canaryFeatures |', () { final provider = TestSdkConfigurationProvider( canaryFeatures: canaryFeatures, verbose: debug, + ddcModuleFormat: moduleFormat, ); tearDownAll(provider.dispose); diff --git a/dwds/test/instances/instance_test.dart b/dwds/test/instances/instance_amd_test.dart similarity index 89% rename from dwds/test/instances/instance_test.dart rename to dwds/test/instances/instance_amd_test.dart index be091d2a5..d87deb5f5 100644 --- a/dwds/test/instances/instance_test.dart +++ b/dwds/test/instances/instance_amd_test.dart @@ -6,6 +6,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'; @@ -16,11 +17,13 @@ void main() { // Enable verbose logging for debugging. final debug = false; final canaryFeatures = false; + final moduleFormat = ModuleFormat.amd; group('canary: $canaryFeatures |', () { final provider = TestSdkConfigurationProvider( canaryFeatures: canaryFeatures, verbose: debug, + ddcModuleFormat: moduleFormat, ); tearDownAll(provider.dispose); diff --git a/dwds/test/instances/instance_ddc_library_bundle_test.dart b/dwds/test/instances/instance_ddc_library_bundle_test.dart new file mode 100644 index 000000000..a06018121 --- /dev/null +++ b/dwds/test/instances/instance_ddc_library_bundle_test.dart @@ -0,0 +1,38 @@ +// Copyright (c) 2025, 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']) +@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/instance_common.dart'; + +void main() { + // Enable verbose logging for debugging. + final debug = false; + final canaryFeatures = true; + final moduleFormat = ModuleFormat.ddc; + final compilationMode = CompilationMode.frontendServer; + + group('canary: $canaryFeatures |', () { + final provider = TestSdkConfigurationProvider( + canaryFeatures: canaryFeatures, + verbose: debug, + ddcModuleFormat: moduleFormat, + ); + tearDownAll(provider.dispose); + + runTests( + provider: provider, + compilationMode: compilationMode, + canaryFeatures: canaryFeatures, + debug: debug, + ); + }); +} diff --git a/fixtures/_testSound/example/scopes/main.dart b/fixtures/_testSound/example/scopes/main.dart index 4daa5cd3d..4744a2d38 100644 --- a/fixtures/_testSound/example/scopes/main.dart +++ b/fixtures/_testSound/example/scopes/main.dart @@ -23,6 +23,16 @@ var map = {}; final stream = Stream.value(1); +MyTestClass getLibraryPublicFinal() => libraryPublicFinal; + +List getLibraryPublic() => libraryPublic; + +Map getMap() => map; + +Map getIdentityMap() => identityMap; + +Stream getStream() => stream; + void staticFunction(int formal) { print(formal); // Breakpoint: staticFunction }