Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'script.dart'; | |
| 6 import 'scope.dart'; | |
| 7 | |
| 8 VMSourceReport newSourceReport(Scope scope, Map json) { | |
| 9 if (json == null) return null; | |
| 10 assert(json["type"] == "SourceReport"); | |
| 11 return new VMSourceReport._(scope, json); | |
| 12 } | |
| 13 | |
| 14 VMSourceReportCoverage newSourceReportCoverage(Map json) { | |
| 15 if (json == null) return null; | |
| 16 return new VMSourceReportCoverage._(json); | |
| 17 } | |
| 18 | |
| 19 VMSourceReportRange newSourceReportRange(Map json) { | |
| 20 if (json == null) return null; | |
| 21 return new VMSourceReportRange._(json); | |
| 22 } | |
| 23 | |
| 24 class VMSourceReport { | |
| 25 // A list of ranges in the program source. These ranges correspond | |
| 26 // to ranges of executable code in the user's program (functions, | |
| 27 // methods, constructors, etc.) | |
| 28 // | |
| 29 // Note that ranges may nest in other ranges, in the case of nested | |
| 30 // functions. | |
| 31 // | |
| 32 // Note that ranges may be duplicated, in the case of mixins. | |
| 33 final List<VMSourceReportRange> ranges; | |
| 34 | |
| 35 // A list of scripts, referenced by index in the report's ranges. | |
| 36 final List<VMScriptRef> scripts; | |
| 37 | |
| 38 VMSourceReport._(scope, Map json) | |
| 39 : scripts = (json['scripts'] as List) | |
| 40 .map((scriptItem) => newVMScriptRef(scope, scriptItem)) | |
| 41 .toList(), | |
| 42 ranges = (json['ranges'] as List) | |
| 43 .map((scriptItem) => newSourceReportRange(scriptItem)) | |
| 44 .toList(); | |
| 45 } | |
| 46 | |
| 47 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
| |
| 48 // An index into the script table of the SourceReport, indicating | |
| 49 // which script contains this range of code. | |
| 50 final int scriptIndex; | |
| 51 | |
| 52 // The token position at which this range begins. | |
| 53 final int startPos; | |
| 54 | |
| 55 // The token position at which this range ends. Inclusive. | |
| 56 final int endPos; | |
| 57 | |
| 58 // Has this range been compiled by the Dart VM? | |
| 59 final bool compiled; | |
| 60 | |
| 61 /// Code coverage information for this range. Provided only when the | |
| 62 /// Coverage report has been requested and the range has been | |
| 63 /// compiled. | |
| 64 final VMSourceReportCoverage coverage; | |
| 65 | |
| 66 /// Possible breakpoint information for this range, represented as a | |
| 67 /// sorted list of token positions. Provided only when the when the | |
| 68 /// PossibleBreakpoint report has been requested and the range has been | |
| 69 /// compiled. | |
| 70 final List<int> possibleBreakpoints; | |
| 71 | |
| 72 VMSourceReportRange._(Map json) | |
| 73 : scriptIndex = json['scriptIndex'], | |
| 74 endPos = json['endPos'], | |
| 75 startPos = json['startPos'], | |
| 76 compiled = json['compiled'], | |
| 77 coverage = newSourceReportCoverage(json['coverage']), | |
| 78 possibleBreakpoints = json['possibleBreakpoints']; | |
| 79 } | |
| 80 | |
| 81 class VMSourceReportCoverage { | |
| 82 /// A list of token positions in a SourceReportRange which have been | |
| 83 /// executed. | |
| 84 /// | |
| 85 /// The list is sorted. | |
| 86 final List<int> hits; | |
| 87 | |
| 88 /// A list of token positions in a SourceReportRange which have not been | |
| 89 /// executed. | |
| 90 /// | |
| 91 /// The list is sorted. | |
| 92 final List<int> misses; | |
| 93 | |
| 94 VMSourceReportCoverage._(Map json) | |
| 95 : hits = json['hits'], | |
| 96 misses = json['misses']; | |
| 97 } | |
| OLD | NEW |