@@ -48,15 +48,15 @@ class DartdocGeneratorOptionContext extends DartdocOptionContext
4848/// directory.
4949class Dartdoc extends PackageBuilder {
5050 final List <Generator > generators;
51- final Set <String > writtenFiles = new Set ();
51+ final Set <String > writtenFiles = Set ();
5252 Directory outputDir;
5353
5454 // Fires when the self checks make progress.
5555 final StreamController <String > _onCheckProgress =
56- new StreamController (sync : true );
56+ StreamController (sync : true );
5757
5858 Dartdoc ._(DartdocOptionContext config, this .generators) : super (config) {
59- outputDir = new Directory (config.output)..createSync (recursive: true );
59+ outputDir = Directory (config.output)..createSync (recursive: true );
6060 generators.forEach ((g) => g.onFileCreated.listen (logProgress));
6161 }
6262
@@ -65,19 +65,19 @@ class Dartdoc extends PackageBuilder {
6565 static Future <Dartdoc > withDefaultGenerators (
6666 DartdocGeneratorOptionContext config) async {
6767 List <Generator > generators = await initGenerators (config);
68- return new Dartdoc ._(config, generators);
68+ return Dartdoc ._(config, generators);
6969 }
7070
7171 /// An asynchronous factory method that builds
7272 static Future <Dartdoc > withEmptyGenerator (DartdocOptionContext config) async {
7373 List <Generator > generators = await initEmptyGenerators (config);
74- return new Dartdoc ._(config, generators);
74+ return Dartdoc ._(config, generators);
7575 }
7676
7777 /// Basic synchronous factory that gives a stripped down Dartdoc that won't
7878 /// use generators. Useful for testing.
7979 factory Dartdoc .withoutGenerators (DartdocOptionContext config) {
80- return new Dartdoc ._(config, []);
80+ return Dartdoc ._(config, []);
8181 }
8282
8383 Stream <String > get onCheckProgress => _onCheckProgress.stream;
@@ -90,7 +90,7 @@ class Dartdoc extends PackageBuilder {
9090 /// thrown if dartdoc fails in an expected way, for example if there is an
9191 /// analysis error in the code.
9292 Future <DartdocResults > generateDocsBase () async {
93- Stopwatch _stopwatch = new Stopwatch ()..start ();
93+ Stopwatch _stopwatch = Stopwatch ()..start ();
9494 double seconds;
9595 packageGraph = await buildPackageGraph ();
9696 seconds = _stopwatch.elapsedMilliseconds / 1000.0 ;
@@ -125,23 +125,21 @@ class Dartdoc extends PackageBuilder {
125125 logInfo (
126126 "Documented ${packageGraph .localPublicLibraries .length } public librar${packageGraph .localPublicLibraries .length == 1 ? 'y' : 'ies' } "
127127 "in ${seconds .toStringAsFixed (1 )} seconds" );
128- return new DartdocResults (
129- config.topLevelPackageMeta, packageGraph, outputDir);
128+ return DartdocResults (config.topLevelPackageMeta, packageGraph, outputDir);
130129 }
131130
132131 Future <DartdocResults > generateDocs () async {
133132 logPrint ("Documenting ${config .topLevelPackageMeta }..." );
134133
135134 DartdocResults dartdocResults = await generateDocsBase ();
136135 if (dartdocResults.packageGraph.localPublicLibraries.isEmpty) {
137- throw new DartdocFailure (
138- "dartdoc could not find any libraries to document" );
136+ throw DartdocFailure ("dartdoc could not find any libraries to document" );
139137 }
140138
141139 final int errorCount =
142140 dartdocResults.packageGraph.packageWarningCounter.errorCount;
143141 if (errorCount > 0 ) {
144- throw new DartdocFailure (
142+ throw DartdocFailure (
145143 "dartdoc encountered $errorCount } errors while processing." );
146144 }
147145 logInfo (
@@ -156,7 +154,7 @@ class Dartdoc extends PackageBuilder {
156154 // Ordinarily this would go in [Package.warn], but we don't actually know what
157155 // ModelElement to warn on yet.
158156 Warnable warnOnElement;
159- Set <Warnable > referredFromElements = new Set ();
157+ Set <Warnable > referredFromElements = Set ();
160158 Set <Warnable > warnOnElements;
161159
162160 // Make all paths relative to origin.
@@ -202,7 +200,7 @@ class Dartdoc extends PackageBuilder {
202200 String indexJson = path.joinAll ([normalOrigin, 'index.json' ]);
203201 bool foundIndexJson = false ;
204202 for (FileSystemEntity f
205- in new Directory (normalOrigin).listSync (recursive: true )) {
203+ in Directory (normalOrigin).listSync (recursive: true )) {
206204 var fullPath = path.normalize (f.path);
207205 if (f is Directory ) {
208206 continue ;
@@ -240,7 +238,7 @@ class Dartdoc extends PackageBuilder {
240238 // This is extracted to save memory during the check; be careful not to hang
241239 // on to anything referencing the full file and doc tree.
242240 Tuple2 <Iterable <String >, String > _getStringLinksAndHref (String fullPath) {
243- File file = new File ("$fullPath " );
241+ File file = File ("$fullPath " );
244242 if (! file.existsSync ()) {
245243 return null ;
246244 }
@@ -256,21 +254,21 @@ class Dartdoc extends PackageBuilder {
256254 .where ((href) => href != null )
257255 .toList ();
258256
259- return new Tuple2 (stringLinks, baseHref);
257+ return Tuple2 (stringLinks, baseHref);
260258 }
261259
262260 void _doSearchIndexCheck (
263261 PackageGraph packageGraph, String origin, Set <String > visited) {
264262 String fullPath = path.joinAll ([origin, 'index.json' ]);
265263 String indexPath = path.joinAll ([origin, 'index.html' ]);
266- File file = new File ("$fullPath " );
264+ File file = File ("$fullPath " );
267265 if (! file.existsSync ()) {
268266 return null ;
269267 }
270- JsonDecoder decoder = new JsonDecoder ();
268+ JsonDecoder decoder = JsonDecoder ();
271269 List jsonData = decoder.convert (file.readAsStringSync ());
272270
273- Set <String > found = new Set ();
271+ Set <String > found = Set ();
274272 found.add (fullPath);
275273 // The package index isn't supposed to be in the search, so suppress the
276274 // warning.
@@ -322,9 +320,9 @@ class Dartdoc extends PackageBuilder {
322320 // here instead -- occasionally, very large jobs have overflowed
323321 // the stack without this.
324322 // (newPathToCheck, newFullPath)
325- Set <Tuple2 <String , String >> toVisit = new Set ();
323+ Set <Tuple2 <String , String >> toVisit = Set ();
326324
327- final RegExp ignoreHyperlinks = new RegExp (r'^(https:|http:|mailto:|ftp:)' );
325+ final RegExp ignoreHyperlinks = RegExp (r'^(https:|http:|mailto:|ftp:)' );
328326 for (String href in stringLinks) {
329327 if (! href.startsWith (ignoreHyperlinks)) {
330328 Uri uri;
@@ -345,7 +343,7 @@ class Dartdoc extends PackageBuilder {
345343 String newFullPath = path.joinAll ([origin, newPathToCheck]);
346344 newFullPath = path.normalize (newFullPath);
347345 if (! visited.contains (newFullPath)) {
348- toVisit.add (new Tuple2 (newPathToCheck, newFullPath));
346+ toVisit.add (Tuple2 (newPathToCheck, newFullPath));
349347 visited.add (newFullPath);
350348 }
351349 }
@@ -366,7 +364,7 @@ class Dartdoc extends PackageBuilder {
366364 assert (_hrefs == null );
367365 _hrefs = packageGraph.allHrefs;
368366
369- final Set <String > visited = new Set ();
367+ final Set <String > visited = Set ();
370368 final String start = 'index.html' ;
371369 logInfo ('Validating docs...' );
372370 _doCheck (packageGraph, origin, visited, start);
0 commit comments