OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// This library uses the Dart analyzer to find the exports for a set of | 5 /// This library uses the Dart analyzer to find the exports for a set of |
6 /// libraries. It stores these exports in an [ExportMap]. This is used to | 6 /// libraries. It stores these exports in an [ExportMap]. This is used to |
7 /// display exported members as part of the exporting library, since dart2js | 7 /// display exported members as part of the exporting library, since dart2js |
8 /// doesn't provide this information itself. | 8 /// doesn't provide this information itself. |
9 library export_map; | 9 library export_map; |
10 | 10 |
11 import 'dart:io'; | 11 import 'dart:io'; |
12 | 12 |
13 import 'package:analyzer_experimental/analyzer.dart'; | 13 import 'package:analyzer_experimental/analyzer.dart'; |
14 import 'package:pathos/path.dart' as pathos; | 14 import 'package:path/path.dart' as pathos; |
15 | 15 |
16 import 'dartdoc/utils.dart'; | 16 import 'dartdoc/utils.dart'; |
17 | 17 |
18 /// A class that tracks which libraries export which other libraries. | 18 /// A class that tracks which libraries export which other libraries. |
19 class ExportMap { | 19 class ExportMap { |
20 /// A map from libraries to their [Export]s. | 20 /// A map from libraries to their [Export]s. |
21 /// | 21 /// |
22 /// Each key is the absolute path of a library on the filesystem, and each | 22 /// Each key is the absolute path of a library on the filesystem, and each |
23 /// value is a list of [Export]s for that library. There's guaranteed to be | 23 /// value is a list of [Export]s for that library. There's guaranteed to be |
24 /// only one [Export] of a given library in a given list. | 24 /// only one [Export] of a given library in a given list. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 /// A simple visitor that collects import and export nodes. | 289 /// A simple visitor that collects import and export nodes. |
290 class _ImportExportCollector extends GeneralizingASTVisitor { | 290 class _ImportExportCollector extends GeneralizingASTVisitor { |
291 final imports = <ImportDirective>[]; | 291 final imports = <ImportDirective>[]; |
292 final exports = <ExportDirective>[]; | 292 final exports = <ExportDirective>[]; |
293 | 293 |
294 _ImportExportCollector(); | 294 _ImportExportCollector(); |
295 | 295 |
296 visitImportDirective(ImportDirective node) => imports.add(node); | 296 visitImportDirective(ImportDirective node) => imports.add(node); |
297 visitExportDirective(ExportDirective node) => exports.add(node); | 297 visitExportDirective(ExportDirective node) => exports.add(node); |
298 } | 298 } |
OLD | NEW |