Skip to content

Commit b082d6a

Browse files
committed
removed unecessary methods and branching
1 parent bd8a5d9 commit b082d6a

File tree

3 files changed

+26
-91
lines changed

3 files changed

+26
-91
lines changed

dwds/lib/src/debugging/dart_runtime_debugger.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,4 @@ class DartRuntimeDebugger {
231231
),
232232
);
233233
}
234-
235-
/// Generates a JS expression to retrieve a library variable.
236-
/// This method is only available for the `RequireStrategy`.
237-
String getLibraryVariableJsExpression(
238-
String libraryUri,
239-
String libraryName,
240-
String variable,
241-
) {
242-
return '${_loadStrategy.loadModuleSnippet}("dart_sdk").dart.getModuleLibraries("$libraryName")["$libraryUri"]["$variable"]';
243-
}
244234
}

dwds/lib/src/debugging/inspector.dart

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ class AppInspector implements AppInspectorInterface {
278278
Future<RemoteObject> invoke(
279279
String targetId,
280280
String selector,
281-
List<dynamic> arguments,
281+
[
282+
List<dynamic> arguments = const [],
283+
]
282284
) async {
283285
final remoteArguments =
284286
arguments.cast<String>().map(remoteObjectFor).toList();
@@ -368,49 +370,6 @@ class AppInspector implements AppInspectorInterface {
368370
return _jsCallFunction(expression, arguments);
369371
}
370372

371-
/// Evaluates the specified top-level variable [variableName] within the
372-
/// library identified by [libraryName] and [libraryUri] using the
373-
/// RequireStrategy.
374-
Future<RemoteObject> _evaluateLibraryVariable(
375-
String libraryUri,
376-
String libraryName,
377-
String variableName,
378-
) {
379-
return jsEvaluate(
380-
globalToolConfiguration.loadStrategy.dartRuntimeDebugger
381-
.getLibraryVariableJsExpression(
382-
libraryUri,
383-
libraryName,
384-
variableName,
385-
),
386-
);
387-
}
388-
389-
/// Retrieves a reference to a library variable or method by evaluating
390-
/// the specified [variableName] or invoking the provided [methodName].
391-
/// The evaluation method is determined based on the current load strategy.
392-
///
393-
/// If the load strategy uses `DdcLibraryBundleStrategy`, it evaluates the
394-
/// method with the given [libraryUri] and [methodName]. Otherwise, it
395-
/// evaluates the variable using [libraryUri], [libraryName], and [variableName].
396-
Future<RemoteObject> getLibraryReference(
397-
String libraryUri,
398-
String libraryName,
399-
String variableName,
400-
String methodName,
401-
) {
402-
return globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy
403-
? _evaluateLibraryMethodWithDdcLibraryBundle(
404-
libraryUri,
405-
methodName,
406-
)
407-
: _evaluateLibraryVariable(
408-
libraryUri,
409-
libraryName,
410-
variableName,
411-
);
412-
}
413-
414373
/// Call [function] with objects referred by [argumentIds] as arguments.
415374
@override
416375
Future<RemoteObject> callFunction(

dwds/test/instances/common/instance_common.dart

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -121,61 +121,47 @@ void runTests({
121121

122122
final libraryUri = 'org-dartlang-app:///example/scopes/main.dart';
123123

124-
String libraryName(CompilationMode compilationMode) =>
125-
compilationMode == CompilationMode.frontendServer
126-
? 'example/scopes/main.dart'
127-
: 'example/scopes/main';
128-
129-
/// Retrieves a reference to a library variable or method by evaluating
130-
/// the specified [variableName] and invoking the provided [methodName].
131-
/// The target library must define both [variableName] and [methodName].
132-
Future<RemoteObject> fetchLibraryReference(
133-
String variableName,
134-
String methodName,
135-
) =>
136-
inspector.getLibraryReference(
137-
libraryUri,
138-
libraryName(compilationMode),
139-
variableName,
140-
methodName,
141-
);
142-
143124
String newInterceptorsExpression(String type) =>
144125
'new (require("dart_sdk")._interceptors.$type).new()';
145126

146127
final newDartError = 'new (require("dart_sdk").dart).DartError';
147128

148129
/// A reference to the the variable `libraryPublicFinal`, an instance of
149130
/// `MyTestClass`.
150-
Future<RemoteObject> getLibraryPublicFinalRef() => fetchLibraryReference(
151-
'libraryPublicFinal',
131+
Future<RemoteObject> getLibraryPublicFinalRef() => inspector.invoke(
132+
libraryUri,
152133
'getLibraryPublicFinal',
153134
);
154135

155136
/// A reference to the the variable `libraryPublic`, a List of Strings.
156-
Future<RemoteObject> getLibraryPublicRef() => fetchLibraryReference(
157-
'libraryPublic',
137+
Future<RemoteObject> getLibraryPublicRef() => inspector.invoke(
138+
libraryUri,
158139
'getLibraryPublic',
159140
);
160141

161142
/// A reference to the variable `map`.
162-
Future<RemoteObject> getMapRef() => fetchLibraryReference(
163-
'map',
143+
Future<RemoteObject> getMapRef() => inspector.invoke(
144+
libraryUri,
164145
'getMap',
165146
);
166147

167148
/// A reference to the variable `identityMap`.
168-
Future<RemoteObject> getIdentityMapRef() => fetchLibraryReference(
169-
'identityMap',
149+
Future<RemoteObject> getIdentityMapRef() => inspector.invoke(
150+
libraryUri,
170151
'getIdentityMap',
171152
);
172153

173154
/// A reference to the variable `stream`.
174-
Future<RemoteObject> getStreamRef() => fetchLibraryReference(
175-
'stream',
155+
Future<RemoteObject> getStreamRef() => inspector.invoke(
156+
libraryUri,
176157
'getStream',
177158
);
178159

160+
final unsupportedTestMsg =
161+
'This test is not supported with the DDC Library '
162+
"Bundle Format because the dartDevEmbedder doesn't let you access compiled "
163+
'constructors at runtime.';
164+
179165
group('instanceRef', () {
180166
setUp(() => setCurrentLogWriter(debug: debug));
181167

@@ -292,7 +278,7 @@ void runTests({
292278
},
293279
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
294280
canaryFeatures == true
295-
? 'This test is not supported with the DDC Library Bundle Format.'
281+
? unsupportedTestMsg
296282
: null,
297283
);
298284

@@ -310,7 +296,7 @@ void runTests({
310296
},
311297
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
312298
canaryFeatures == true
313-
? 'This test is not supported with the DDC Library Bundle Format.'
299+
? unsupportedTestMsg
314300
: null,
315301
);
316302

@@ -328,7 +314,7 @@ void runTests({
328314
},
329315
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
330316
canaryFeatures == true
331-
? 'This test is not supported with the DDC Library Bundle Format.'
317+
? unsupportedTestMsg
332318
: null,
333319
);
334320

@@ -346,7 +332,7 @@ void runTests({
346332
},
347333
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
348334
canaryFeatures == true
349-
? 'This test is not supported with the DDC Library Bundle Format.'
335+
? unsupportedTestMsg
350336
: null,
351337
);
352338
});
@@ -472,7 +458,7 @@ void runTests({
472458
},
473459
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
474460
canaryFeatures == true
475-
? 'This test is not supported with the DDC Library Bundle Format.'
461+
? unsupportedTestMsg
476462
: null,
477463
);
478464

@@ -490,7 +476,7 @@ void runTests({
490476
},
491477
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
492478
canaryFeatures == true
493-
? 'This test is not supported with the DDC Library Bundle Format.'
479+
? unsupportedTestMsg
494480
: null,
495481
);
496482

@@ -508,7 +494,7 @@ void runTests({
508494
},
509495
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
510496
canaryFeatures == true
511-
? 'This test is not supported with the DDC Library Bundle Format.'
497+
? unsupportedTestMsg
512498
: null,
513499
);
514500

@@ -526,7 +512,7 @@ void runTests({
526512
},
527513
skip: provider.ddcModuleFormat == ModuleFormat.ddc &&
528514
canaryFeatures == true
529-
? 'This test is not supported with the DDC Library Bundle Format.'
515+
? unsupportedTestMsg
530516
: null,
531517
);
532518
});

0 commit comments

Comments
 (0)