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 /// Represents a set of reports tied to source locations in an isolate. | |
nweiz
2016/04/29 00:52:44
This should be a noun phrase rather than "Represen
kevmoo
2016/04/29 23:36:55
Done.
| |
25 class VMSourceReport { | |
26 /// A list of ranges in the program source. These ranges correspond | |
27 /// to ranges of executable code in the user's program (functions, | |
28 /// methods, constructors, etc.) | |
nweiz
2016/04/29 00:52:43
The first paragraph of a doc comment should always
kevmoo
2016/04/29 23:36:54
Done.
| |
29 /// | |
30 /// Note that ranges may nest in other ranges, in the case of nested | |
31 /// functions. | |
32 /// | |
33 /// Note that ranges may be duplicated, in the case of mixins. | |
nweiz
2016/04/29 00:52:44
Somewhere in here you should mention what informat
kevmoo
2016/04/29 23:36:55
Done.
nweiz
2016/05/04 23:05:51
I don't see this.
kevmoo
2016/05/05 20:46:25
See latest patch
| |
34 final List<VMSourceReportRange> ranges; | |
35 | |
36 /// A list of scripts, referenced by index in the report's ranges. | |
37 final List<VMScriptRef> scripts; | |
38 | |
39 VMSourceReport._(scope, Map json) | |
40 : scripts = (json['scripts'] as List) | |
41 .map((scriptItem) => newVMScriptRef(scope, scriptItem)) | |
42 .toList(), | |
nweiz
2016/04/29 00:52:44
These should be unmodifiable lists. See other clas
kevmoo
2016/04/29 23:36:54
Done.
| |
43 ranges = (json['ranges'] as List) | |
44 .map((scriptItem) => newSourceReportRange(scriptItem)) | |
45 .toList(); | |
46 } | |
47 | |
48 /// Represents a range of executable code (function, method, constructor, etc) | |
49 /// in the running program. | |
50 /// | |
51 /// It is part of a [VMSourceReport]. | |
nweiz
2016/04/29 00:52:43
"It" -> "This" or "Each range"
kevmoo
2016/04/29 23:36:54
Done.
| |
52 class VMSourceReportRange { | |
53 /// An index into the script table of the SourceReport, indicating | |
54 /// which script contains this range of code. | |
55 final int scriptIndex; | |
nweiz
2016/04/29 00:52:43
Automatically cross-reference this. Get rid of VMS
kevmoo
2016/04/29 23:36:54
Done.
| |
56 | |
57 /// The token position at which this range begins. | |
58 final int startPos; | |
59 | |
60 /// The token position at which this range ends. Inclusive. | |
61 final int endPos; | |
nweiz
2016/04/29 00:52:44
Instead of having raw start and end positions, exp
kevmoo
2016/04/29 23:36:54
Done.
| |
62 | |
63 /// Has this range been compiled by the Dart VM? | |
nweiz
2016/04/29 00:52:43
Don't phrase documentation as questions.
Explain
kevmoo
2016/04/29 23:36:54
Done.
| |
64 final bool compiled; | |
65 | |
66 /// Code coverage information for this range. | |
67 /// | |
68 /// Provided only when the | |
69 /// `includeCoverageReport` is true and the range has been | |
nweiz
2016/04/29 00:52:44
It's not clear what "includeCoverageReport" is ref
kevmoo
2016/04/29 23:36:54
Done - did not refer to just the isolate method si
| |
70 /// compiled. | |
71 final VMSourceReportCoverage coverage; | |
nweiz
2016/04/29 00:52:43
I don't know if there's a lot of value in requirin
kevmoo
2016/04/29 23:36:54
Done.
| |
72 | |
73 /// Possible breakpoint information for this range, represented as a | |
nweiz
2016/04/29 00:52:44
"Possible breakpoint information" isn't very infor
kevmoo
2016/04/29 23:36:54
Done.
| |
74 /// sorted list of token positions. | |
75 /// | |
76 /// Provided only when the when the | |
77 /// `includePossibleBreakpoints` is `true` and the range has been | |
78 /// compiled. | |
79 final List<int> possibleBreakpoints; | |
nweiz
2016/04/29 00:52:44
Make this a list of VMScriptTokens. Same with hits
kevmoo
2016/04/29 23:36:54
Done.
| |
80 | |
81 VMSourceReportRange._(Map json) | |
82 : scriptIndex = json['scriptIndex'], | |
83 endPos = json['endPos'], | |
84 startPos = json['startPos'], | |
85 compiled = json['compiled'], | |
86 coverage = newSourceReportCoverage(json['coverage']), | |
87 possibleBreakpoints = json['possibleBreakpoints']; | |
88 } | |
89 | |
90 /// Represents coverage information for one [VMSourceReportRange]. | |
91 class VMSourceReportCoverage { | |
92 /// A list of token positions in a SourceReportRange which have been | |
93 /// executed. | |
94 /// | |
95 /// The list is sorted. | |
nweiz
2016/04/29 00:52:44
Sorted by what?
kevmoo
2016/04/29 23:36:54
for ints, I think that's implicit.
nweiz
2016/05/04 23:05:51
It's certainly not obvious whether it's ascending
kevmoo
2016/05/05 20:46:25
Done.
| |
96 final List<int> hits; | |
97 | |
98 /// A list of token positions in a SourceReportRange which have not been | |
nweiz
2016/04/29 00:52:44
"not been" -> "not yet been"
kevmoo
2016/04/29 23:36:54
Done.
| |
99 /// executed. | |
100 /// | |
101 /// The list is sorted. | |
102 final List<int> misses; | |
103 | |
104 VMSourceReportCoverage._(Map json) | |
105 : hits = json['hits'], | |
106 misses = json['misses']; | |
107 } | |
OLD | NEW |