Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: lib/src/script.dart

Issue 1929063002: pkg/vm_service_client: add getSourceReport to VMServiceReference (Closed) Base URL: https://github.com/dart-lang/vm_service_client.git@master
Patch Set: changelog oops Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/script.dart
diff --git a/lib/src/script.dart b/lib/src/script.dart
index 12f4bfac80501fc627b615daf269d62a326cca5d..bc8f5a68dd9d819ea953989910b69ef8f46e63e0 100644
--- a/lib/src/script.dart
+++ b/lib/src/script.dart
@@ -14,6 +14,7 @@ import 'library.dart';
import 'object.dart';
import 'scope.dart';
import 'source_location.dart';
+import 'source_report.dart';
VMScriptRef newVMScriptRef(Scope scope, Map json) {
if (json == null) return null;
@@ -68,6 +69,53 @@ class VMScriptRef implements VMObjectRef {
}
}
+ /// Generates a set of reports tied to this script.
+ ///
+ /// Set [includeCoverageReport] to `true` to include code coverage
+ /// information.
+ ///
+ /// Set [includePossibleBreakpoints] to `true` to provide a list of token
+ /// positions which correspond to possible breakpoints.
+ ///
+ /// Either or both of the [tokenPos] and [endTokenPos] parameters may be
+ /// provided to restrict the analysis to a subrange of a script
+ /// (for example, these can be used to restrict the report to the range of a
+ /// particular class or function).
+ ///
+ /// Set [forceCompilation] to `true` to force compilation of all functions in
+ /// the range of the report.
+ /// Forcing compilation can cause a compilation error, which could terminate
+ /// the running Dart program.
+ Future<VMSourceReport> getSourceReport(
+ {bool includeCoverageReport,
+ bool includePossibleBreakpoints,
+ int tokenPos,
+ int endTokenPos,
nweiz 2016/04/29 00:52:43 These should come after [forceCompile]. That way t
kevmoo 2016/04/29 23:36:54 Done
nweiz 2016/05/04 23:05:51 I don't understand how users would possibly get in
kevmoo 2016/05/05 20:46:25 This was fixed – now uses tokens
nweiz 2016/05/11 23:03:30 What I'm saying is that it should take a single So
kevmoo 2016/05/12 05:22:34 But one cannot create a SourceLocation from whole
nweiz 2016/05/17 20:54:41 That is not a use-case I'm concerned about. I'm t
kevmoo 2016/05/17 22:12:01 Acknowledged.
+ bool forceCompile}) async {
+ var reports = <String>[];
+ if (includeCoverageReport == true) {
+ reports.add('Coverage');
+ }
+
+ if (includePossibleBreakpoints == true) {
+ reports.add('PossibleBreakpoints');
+ }
+
+ var params = <String, dynamic>{'reports': reports, 'scriptId': _id};
+
+ if (tokenPos != null) {
+ params['tokenPos'] = tokenPos;
+ }
+
+ if (endTokenPos != null) {
+ params['endTokenPos'] = endTokenPos;
+ }
+
+ var json = await _scope.sendRequest('getSourceReport', params);
+
+ return newSourceReport(_scope, json);
+ }
nweiz 2016/04/29 00:52:43 Most of the same comments for the other method app
kevmoo 2016/04/29 23:36:54 Acknowledged.
+
bool operator ==(other) => other is VMScriptRef &&
(_fixedId ? _id == other._id : super == other);

Powered by Google App Engine
This is Rietveld 408576698