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

Unified Diff: lib/src/source_report.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: 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/source_report.dart
diff --git a/lib/src/source_report.dart b/lib/src/source_report.dart
new file mode 100644
index 0000000000000000000000000000000000000000..051f778c84c877605c4937f560996b96608457fd
--- /dev/null
+++ b/lib/src/source_report.dart
@@ -0,0 +1,97 @@
+// Copyright (c) 2016, 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.
+
+import 'script.dart';
+import 'scope.dart';
+
+VMSourceReport newSourceReport(Scope scope, Map json) {
+ if (json == null) return null;
+ assert(json["type"] == "SourceReport");
+ return new VMSourceReport._(scope, json);
+}
+
+VMSourceReportCoverage newSourceReportCoverage(Map json) {
+ if (json == null) return null;
+ return new VMSourceReportCoverage._(json);
+}
+
+VMSourceReportRange newSourceReportRange(Map json) {
+ if (json == null) return null;
+ return new VMSourceReportRange._(json);
+}
+
+class VMSourceReport {
+ // A list of ranges in the program source. These ranges correspond
+ // to ranges of executable code in the user's program (functions,
+ // methods, constructors, etc.)
+ //
+ // Note that ranges may nest in other ranges, in the case of nested
+ // functions.
+ //
+ // Note that ranges may be duplicated, in the case of mixins.
+ final List<VMSourceReportRange> ranges;
+
+ // A list of scripts, referenced by index in the report's ranges.
+ final List<VMScriptRef> scripts;
+
+ VMSourceReport._(scope, Map json)
+ : scripts = (json['scripts'] as List)
+ .map((scriptItem) => newVMScriptRef(scope, scriptItem))
+ .toList(),
+ ranges = (json['ranges'] as List)
+ .map((scriptItem) => newSourceReportRange(scriptItem))
+ .toList();
+}
+
+class VMSourceReportRange {
nweiz 2016/04/28 19:44:00 These should be in different files.
kevmoo 2016/04/28 20:26:06 Disagree. This is like BreakPoint and BreakPointLo
nweiz 2016/04/29 00:52:43 VMBreakpointLocation should probably also be a sep
+ // An index into the script table of the SourceReport, indicating
+ // which script contains this range of code.
+ final int scriptIndex;
+
+ // The token position at which this range begins.
+ final int startPos;
+
+ // The token position at which this range ends. Inclusive.
+ final int endPos;
+
+ // Has this range been compiled by the Dart VM?
+ final bool compiled;
+
+ /// Code coverage information for this range. Provided only when the
+ /// Coverage report has been requested and the range has been
+ /// compiled.
+ final VMSourceReportCoverage coverage;
+
+ /// Possible breakpoint information for this range, represented as a
+ /// sorted list of token positions. Provided only when the when the
+ /// PossibleBreakpoint report has been requested and the range has been
+ /// compiled.
+ final List<int> possibleBreakpoints;
+
+ VMSourceReportRange._(Map json)
+ : scriptIndex = json['scriptIndex'],
+ endPos = json['endPos'],
+ startPos = json['startPos'],
+ compiled = json['compiled'],
+ coverage = newSourceReportCoverage(json['coverage']),
+ possibleBreakpoints = json['possibleBreakpoints'];
+}
+
+class VMSourceReportCoverage {
+ /// A list of token positions in a SourceReportRange which have been
+ /// executed.
+ ///
+ /// The list is sorted.
+ final List<int> hits;
+
+ /// A list of token positions in a SourceReportRange which have not been
+ /// executed.
+ ///
+ /// The list is sorted.
+ final List<int> misses;
+
+ VMSourceReportCoverage._(Map json)
+ : hits = json['hits'],
+ misses = json['misses'];
+}
« lib/src/script.dart ('K') | « lib/src/script.dart ('k') | lib/vm_service_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698