Skip to content

Commit bc818e2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into hotreload2
2 parents 9b6db74 + a7ea61f commit bc818e2

File tree

7 files changed

+254
-146
lines changed

7 files changed

+254
-146
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 24.3.4
22

3-
- Added support for some debugging APIs with the DDC library bundle format. - [#2566](https://github.com/dart-lang/webdev/issues/2566)
3+
- 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)
44
- Added support for hot reload using the DDC library bundle format.
55

66
## 24.3.3

dwds/lib/src/debugging/inspector.dart

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ class AppInspector implements AppInspectorInterface {
277277
@override
278278
Future<RemoteObject> invoke(
279279
String targetId,
280-
String selector,
281-
List<dynamic> arguments,
282-
) async {
280+
String selector, [
281+
List<dynamic> arguments = const [],
282+
]) async {
283283
final remoteArguments =
284284
arguments.cast<String>().map(remoteObjectFor).toList();
285285
// We special case the Dart library, where invokeMethod won't work because
@@ -302,14 +302,18 @@ class AppInspector implements AppInspectorInterface {
302302
String selector,
303303
List<RemoteObject> arguments,
304304
) {
305+
final libraryUri = library.uri;
306+
if (libraryUri == null) {
307+
throwInvalidParam('invoke', 'library uri is null');
308+
}
305309
return globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy
306310
? _evaluateLibraryMethodWithDdcLibraryBundle(
307-
library,
311+
libraryUri,
308312
selector,
309313
arguments,
310314
)
311315
: _evaluateInLibrary(
312-
library,
316+
libraryUri,
313317
'function () { return this.$selector.apply(this, arguments); }',
314318
arguments,
315319
);
@@ -337,16 +341,12 @@ class AppInspector implements AppInspectorInterface {
337341
}
338342

339343
/// Evaluate the JS function with source [jsFunction] in the context of
340-
/// [library] with [arguments].
344+
/// the library identified by [libraryUri] with [arguments].
341345
Future<RemoteObject> _evaluateInLibrary(
342-
Library library,
346+
String libraryUri,
343347
String jsFunction,
344348
List<RemoteObject> arguments,
345349
) async {
346-
final libraryUri = library.uri;
347-
if (libraryUri == null) {
348-
throwInvalidParam('invoke', 'library uri is null');
349-
}
350350
final findLibraryJsExpression = globalToolConfiguration
351351
.loadStrategy.dartRuntimeDebugger
352352
.callLibraryMethodJsExpression(libraryUri, jsFunction);
@@ -355,18 +355,14 @@ class AppInspector implements AppInspectorInterface {
355355
return jsCallFunctionOn(remoteLibrary, jsFunction, arguments);
356356
}
357357

358-
/// Evaluates the specified top-level method [methodName] within [library]
359-
/// using the Dart Development Compiler (DDC) library bundle strategy with
360-
/// the given [arguments].
358+
/// Evaluates the specified top-level method [methodName] within the library
359+
/// identified by [libraryUri] using the Dart Development Compiler (DDC)
360+
/// library bundle strategy with the given optional [arguments].
361361
Future<RemoteObject> _evaluateLibraryMethodWithDdcLibraryBundle(
362-
Library library,
363-
String methodName,
364-
List<RemoteObject> arguments,
365-
) {
366-
final libraryUri = library.uri;
367-
if (libraryUri == null) {
368-
throwInvalidParam('invoke', 'library uri is null');
369-
}
362+
String libraryUri,
363+
String methodName, [
364+
List<RemoteObject> arguments = const [],
365+
]) {
370366
final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
371367
.callLibraryMethodJsExpression(libraryUri, methodName);
372368
return _jsCallFunction(expression, arguments);

0 commit comments

Comments
 (0)