Skip to content

Commit a558d57

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
Use ///-style doc comments in analyzer/tool
Bug: #33892 Change-Id: I67094e84af2ec54ede00b248a2e67d3cebadc576 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152702 Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent c68fd58 commit a558d57

File tree

7 files changed

+62
-146
lines changed

7 files changed

+62
-146
lines changed

pkg/analyzer/tool/experiments/experiments_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import 'package:path/path.dart';
99

1010
import 'generate.dart';
1111

12-
/**
13-
* Check that all targets have been code generated. If they haven't tell the
14-
* user to run generate_all.dart.
15-
*/
12+
/// Check that all targets have been code generated. If they haven't tell the
13+
/// user to run generate_all.dart.
1614
main() async {
1715
String script = Platform.script.toFilePath(windows: Platform.isWindows);
1816
List<String> components = split(script);

pkg/analyzer/tool/experiments/generate.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/**
2-
* This file contains code to generate experimental flags
3-
* based on the information in tools/experimental_features.yaml.
4-
*/
1+
/// This file contains code to generate experimental flags
2+
/// based on the information in tools/experimental_features.yaml.
53
import 'dart:io';
64

75
import 'package:_fe_analyzer_shared/src/scanner/characters.dart'

pkg/analyzer/tool/messages/generate.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/**
2-
* This file contains code to generate scanner and parser message
3-
* based on the information in pkg/front_end/messages.yaml.
4-
*
5-
* For each message in messages.yaml that contains an 'index:' field,
6-
* this tool generates an error with the name specified by the 'analyzerCode:'
7-
* field and an entry in the fastaAnalyzerErrorList for that generated error.
8-
* The text in the 'analyzerCode:' field must contain the name of the class
9-
* containing the error and the name of the error separated by a `.`
10-
* (e.g. ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND).
11-
*
12-
* It is expected that 'pkg/front_end/tool/fasta generate-messages'
13-
* has already been successfully run.
14-
*/
1+
/// This file contains code to generate scanner and parser message
2+
/// based on the information in pkg/front_end/messages.yaml.
3+
///
4+
/// For each message in messages.yaml that contains an 'index:' field,
5+
/// this tool generates an error with the name specified by the 'analyzerCode:'
6+
/// field and an entry in the fastaAnalyzerErrorList for that generated error.
7+
/// The text in the 'analyzerCode:' field must contain the name of the class
8+
/// containing the error and the name of the error separated by a `.`
9+
/// (e.g. ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND).
10+
///
11+
/// It is expected that 'pkg/front_end/tool/fasta generate-messages'
12+
/// has already been successfully run.
1513
import 'dart:io';
1614

1715
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart';

pkg/analyzer/tool/summary/build_sdk_summaries.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ void main(List<String> args) {
4848
}
4949
}
5050

51-
/**
52-
* The name of the SDK summaries builder application.
53-
*/
51+
/// The name of the SDK summaries builder application.
5452
const BINARY_NAME = "build_sdk_summaries";
5553

5654
void _buildSummary(String sdkPath, String outPath) {
@@ -64,9 +62,7 @@ void _buildSummary(String sdkPath, String outPath) {
6462
print('\tDone in ${sw.elapsedMilliseconds} ms.');
6563
}
6664

67-
/**
68-
* Print information about how to use the SDK summaries builder.
69-
*/
65+
/// Print information about how to use the SDK summaries builder.
7066
void _printUsage() {
7167
print('Usage: $BINARY_NAME command arguments');
7268
print('Where command can be one of the following:');

pkg/analyzer/tool/summary/check_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import 'package:path/path.dart';
88
import '../../test/utils/package_root.dart' as package_root;
99
import 'generate.dart';
1010

11-
/**
12-
* Check that the target file has been code generated. If it hasn't tell the
13-
* user to run generate.dart.
14-
*/
11+
/// Check that the target file has been code generated. If it hasn't tell the
12+
/// user to run generate.dart.
1513
main() async {
1614
var idlFolderPath = normalize(
1715
join(package_root.packageRoot, 'analyzer', 'lib', 'src', 'summary'));

pkg/analyzer/tool/summary/idl_model.dart

Lines changed: 33 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,24 @@
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-
/**
6-
* This file contains a set of concrete classes representing an in-memory
7-
* semantic model of the IDL used to code generate summary serialization and
8-
* deserialization code.
9-
*/
5+
/// This file contains a set of concrete classes representing an in-memory
6+
/// semantic model of the IDL used to code generate summary serialization and
7+
/// deserialization code.
108
import 'package:meta/meta.dart';
119

12-
/**
13-
* Information about a single class defined in the IDL.
14-
*/
10+
/// Information about a single class defined in the IDL.
1511
class ClassDeclaration extends Declaration {
16-
/**
17-
* All fields defined in the class, including deprecated ones.
18-
*/
12+
/// All fields defined in the class, including deprecated ones.
1913
final List<FieldDeclaration> allFields = <FieldDeclaration>[];
2014

21-
/**
22-
* Indicates whether the class has the `topLevel` annotation.
23-
*/
15+
/// Indicates whether the class has the `topLevel` annotation.
2416
final bool isTopLevel;
2517

26-
/**
27-
* If [isTopLevel] is `true` and a file identifier was specified for this
28-
* class, the file identifier string. Otherwise `null`.
29-
*/
18+
/// If [isTopLevel] is `true` and a file identifier was specified for this
19+
/// class, the file identifier string. Otherwise `null`.
3020
final String fileIdentifier;
3121

32-
/**
33-
* Indicates whether the class has the `deprecated` annotation.
34-
*/
22+
/// Indicates whether the class has the `deprecated` annotation.
3523
final bool isDeprecated;
3624

3725
final String variantField;
@@ -45,78 +33,52 @@ class ClassDeclaration extends Declaration {
4533
@required this.variantField,
4634
}) : super(documentation, name);
4735

48-
/**
49-
* Get the non-deprecated fields defined in the class.
50-
*/
36+
/// Get the non-deprecated fields defined in the class.
5137
Iterable<FieldDeclaration> get fields =>
5238
allFields.where((FieldDeclaration field) => !field.isDeprecated);
5339
}
5440

55-
/**
56-
* Information about a declaration in the IDL.
57-
*/
41+
/// Information about a declaration in the IDL.
5842
class Declaration {
59-
/**
60-
* The optional documentation, may be `null`.
61-
*/
43+
/// The optional documentation, may be `null`.
6244
final String documentation;
6345

64-
/**
65-
* The name of the declaration.
66-
*/
46+
/// The name of the declaration.
6747
final String name;
6848

6949
Declaration(this.documentation, this.name);
7050
}
7151

72-
/**
73-
* Information about a single enum defined in the IDL.
74-
*/
52+
/// Information about a single enum defined in the IDL.
7553
class EnumDeclaration extends Declaration {
76-
/**
77-
* List of enumerated values.
78-
*/
54+
/// List of enumerated values.
7955
final List<EnumValueDeclaration> values = <EnumValueDeclaration>[];
8056

8157
EnumDeclaration(String documentation, String name)
8258
: super(documentation, name);
8359
}
8460

85-
/**
86-
* Information about a single enum value defined in the IDL.
87-
*/
61+
/// Information about a single enum value defined in the IDL.
8862
class EnumValueDeclaration extends Declaration {
8963
EnumValueDeclaration(String documentation, String name)
9064
: super(documentation, name);
9165
}
9266

93-
/**
94-
* Information about a single class field defined in the IDL.
95-
*/
67+
/// Information about a single class field defined in the IDL.
9668
class FieldDeclaration extends Declaration {
97-
/**
98-
* The file of the field.
99-
*/
69+
/// The file of the field.
10070
final FieldType type;
10171

102-
/**
103-
* The id of the field.
104-
*/
72+
/// The id of the field.
10573
final int id;
10674

107-
/**
108-
* Indicates whether the field is deprecated.
109-
*/
75+
/// Indicates whether the field is deprecated.
11076
final bool isDeprecated;
11177

112-
/**
113-
* Indicates whether the field is informative.
114-
*/
78+
/// Indicates whether the field is informative.
11579
final bool isInformative;
11680

117-
/**
118-
* Maps logical property names to logical property.
119-
*/
81+
/// Maps logical property names to logical property.
12082
final Map<String, LogicalProperty> logicalProperties;
12183

12284
FieldDeclaration({
@@ -130,19 +92,13 @@ class FieldDeclaration extends Declaration {
13092
}) : super(documentation, name);
13193
}
13294

133-
/**
134-
* Information about the type of a class field defined in the IDL.
135-
*/
95+
/// Information about the type of a class field defined in the IDL.
13696
class FieldType {
137-
/**
138-
* Type of the field (e.g. 'int').
139-
*/
97+
/// Type of the field (e.g. 'int').
14098
final String typeName;
14199

142-
/**
143-
* Indicates whether this field contains a list of the type specified in
144-
* [typeName].
145-
*/
100+
/// Indicates whether this field contains a list of the type specified in
101+
/// [typeName].
146102
final bool isList;
147103

148104
FieldType(this.typeName, this.isList);
@@ -166,38 +122,24 @@ class FieldType {
166122
String toString() => isList ? 'List<$typeName>' : typeName;
167123
}
168124

169-
/**
170-
* Top level representation of the summary IDL.
171-
*/
125+
/// Top level representation of the summary IDL.
172126
class Idl {
173-
/**
174-
* Classes defined in the IDL.
175-
*/
127+
/// Classes defined in the IDL.
176128
final Map<String, ClassDeclaration> classes = <String, ClassDeclaration>{};
177129

178-
/**
179-
* Enums defined in the IDL.
180-
*/
130+
/// Enums defined in the IDL.
181131
final Map<String, EnumDeclaration> enums = <String, EnumDeclaration>{};
182132
}
183133

184-
/**
185-
* Information about a logical property mapped to a single data fields.
186-
*/
134+
/// Information about a logical property mapped to a single data fields.
187135
class LogicalProperty {
188-
/**
189-
* Indicates whether the property is deprecated.
190-
*/
136+
/// Indicates whether the property is deprecated.
191137
final bool isDeprecated;
192138

193-
/**
194-
* Indicates whether the property is informative.
195-
*/
139+
/// Indicates whether the property is informative.
196140
final bool isInformative;
197141

198-
/**
199-
* Names of variants in which this property is available.
200-
*/
142+
/// Names of variants in which this property is available.
201143
final List<String> variants;
202144

203145
LogicalProperty({

pkg/analyzer/tool/summary/stats.dart

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
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-
/**
6-
* This file contains code for collecting statistics about the use of fields in
7-
* a summary file.
8-
*/
5+
/// This file contains code for collecting statistics about the use of fields in
6+
/// a summary file.
97
import 'dart:io';
108
import 'dart:mirrors';
119

@@ -31,31 +29,21 @@ main(List<String> args) {
3129
stats.dump();
3230
}
3331

34-
/**
35-
* The name of the stats tool.
36-
*/
32+
/// The name of the stats tool.
3733
const String BINARY_NAME = "stats";
3834

39-
/**
40-
* Print information about how to use the stats tool.
41-
*/
35+
/// Print information about how to use the stats tool.
4236
void _printUsage() {
4337
print('Usage: $BINARY_NAME input_file_path');
4438
}
4539

46-
/**
47-
* An instance of [Stats] keeps track of statistics about the use of fields in
48-
* summary objects.
49-
*/
40+
/// An instance of [Stats] keeps track of statistics about the use of fields in
41+
/// summary objects.
5042
class Stats {
51-
/**
52-
* Map from type to field name to a count of how often the field is used.
53-
*/
43+
/// Map from type to field name to a count of how often the field is used.
5444
Map<Type, Map<String, int>> counts = <Type, Map<String, int>>{};
5545

56-
/**
57-
* Print out statistics gathered so far.
58-
*/
46+
/// Print out statistics gathered so far.
5947
void dump() {
6048
counts.forEach((Type type, Map<String, int> typeCounts) {
6149
print(type);
@@ -68,9 +56,7 @@ class Stats {
6856
});
6957
}
7058

71-
/**
72-
* Record statistics for [obj] and all objects it refers to.
73-
*/
59+
/// Record statistics for [obj] and all objects it refers to.
7460
void record(SummaryClass obj) {
7561
Map<String, int> typeCounts =
7662
counts.putIfAbsent(obj.runtimeType, () => <String, int>{});

0 commit comments

Comments
 (0)