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
5- import 'package:dwds/src /loaders/strategy.dart' ;
5+ import '.. /loaders/strategy.dart' ;
66
77class DartRuntimeDebugger {
88 final LoadStrategy _loadStrategy;
@@ -104,15 +104,18 @@ class DartRuntimeDebugger {
104104 return _wrapInIIFE (expression);
105105 }
106106
107- /// Generates a JS expression for retrieving Dart Developer Extension Names.
107+ /// Generates a JS expression for retrieving Dart Developer Extension
108+ /// Names.
108109 String getDartDeveloperExtensionNamesJsExpression () {
109110 return _generateJsExpression (
110- "${_loadStrategy .loadModuleSnippet }('dart_sdk').developer._extensions.keys.toList();" ,
111+ "${_loadStrategy .loadModuleSnippet }('dart_sdk').developer"
112+ '._extensions.keys.toList();' ,
111113 'dartDevEmbedder.debugger.extensionNames' ,
112114 );
113115 }
114116
115- /// Generates a JS expression for retrieving metadata of classes in a library.
117+ /// Generates a JS expression for retrieving metadata of classes in a
118+ /// library.
116119 String getClassesInLibraryJsExpression (String libraryUri) {
117120 final expression = _buildExpression (
118121 '' ,
@@ -167,32 +170,39 @@ class DartRuntimeDebugger {
167170 );
168171 }
169172
170- /// Generates a JS expression for calling an instance method on an object.
173+ /// Generates a JS expression for calling an instance method on an
174+ /// object.
171175 String callInstanceMethodJsExpression (String methodName) {
172176 String generateInstanceMethodJsExpression (String functionCall) {
173177 return '''
174178 function () {
175- if (!Object.getPrototypeOf(this)) { return 'Instance of PlainJavaScriptObject'; }
179+ if (!Object.getPrototypeOf(this)) {
180+ return 'Instance of PlainJavaScriptObject';
181+ }
176182 return $functionCall ;
177183 }
178184 ''' ;
179185 }
180186
181187 return _generateJsExpression (
182188 generateInstanceMethodJsExpression (
183- '${_loadStrategy .loadModuleSnippet }("dart_sdk").dart.dsendRepl(this, "$methodName ", arguments)' ,
189+ '${_loadStrategy .loadModuleSnippet }("dart_sdk").dart'
190+ '.dsendRepl(this, "$methodName ", arguments)' ,
184191 ),
185192 generateInstanceMethodJsExpression (
186- 'dartDevEmbedder.debugger.callInstanceMethod(this, "$methodName ", arguments)' ,
193+ 'dartDevEmbedder.debugger'
194+ '.callInstanceMethod(this, "$methodName ", arguments)' ,
187195 ),
188196 );
189197 }
190198
191199 /// Generates a JS expression to invoke a Dart extension method.
192200 String invokeExtensionJsExpression (String methodName, String encodedJson) {
193201 return _generateJsExpression (
194- "${_loadStrategy .loadModuleSnippet }('dart_sdk').developer.invokeExtension('$methodName ', JSON.stringify($encodedJson ));" ,
195- "dartDevEmbedder.debugger.invokeExtension('$methodName ', JSON.stringify($encodedJson ));" ,
202+ "${_loadStrategy .loadModuleSnippet }('dart_sdk').developer"
203+ ".invokeExtension('$methodName ', JSON.stringify($encodedJson ));" ,
204+ 'dartDevEmbedder.debugger'
205+ ".invokeExtension('$methodName ', JSON.stringify($encodedJson ));" ,
196206 );
197207 }
198208
@@ -209,14 +219,15 @@ class DartRuntimeDebugger {
209219 })();
210220 ''' ;
211221
212- // `callLibraryMethod` expects an array of arguments. Chrome DevTools spreads
213- // arguments individually when calling functions. This code reconstructs the
214- // expected argument array.
222+ // `callLibraryMethod` expects an array of arguments. Chrome DevTools
223+ // spreads arguments individually when calling functions. This code
224+ // reconstructs the expected argument array.
215225 return _generateJsExpression (
216226 findLibraryExpression,
217227 _wrapWithBundleLoader (
218228 '' ,
219- 'callLibraryMethod("$libraryUri ", "$methodName ", Array.from(arguments))' ,
229+ 'callLibraryMethod("$libraryUri ", "$methodName ", '
230+ 'Array.from(arguments))' ,
220231 ),
221232 );
222233 }
0 commit comments