Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: utils/apidoc/html_diff.dart

Issue 12446003: Support full dart2js output for dartdoc/apidoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/apidoc/apidoc.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/apidoc/html_diff.dart
diff --git a/utils/apidoc/html_diff.dart b/utils/apidoc/html_diff.dart
index 3c8324d10795857af688dd5c0f3bc8e4c71368ac..3bda2ccf147c12cdc56736f299af800ce44a6adb 100644
--- a/utils/apidoc/html_diff.dart
+++ b/utils/apidoc/html_diff.dart
@@ -17,6 +17,7 @@ import 'lib/metadata.dart';
import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart';
import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart';
+import '../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';
// TODO(amouravski): There is currently magic that looks at dart:* libraries
// rather than the declared library names. This changed due to recent syntax
@@ -69,23 +70,8 @@ class HtmlDiff {
/** If true, then print warning messages. */
final bool _printWarnings;
- static Compilation _compilation;
- static MirrorSystem _mirrors;
static LibraryMirror dom;
- /**
- * Perform static initialization of [world]. This should be run before
- * calling [HtmlDiff.run].
- */
- static void initialize(Path libDir) {
- var paths = <Path>[];
- for (var libraryName in HTML_LIBRARY_NAMES) {
- paths.add(new Path(libraryName));
- }
- _compilation = new Compilation.library(paths, libDir);
- _mirrors = _compilation.mirrors;
- }
-
HtmlDiff({bool printWarnings: false}) :
_printWarnings = printWarnings,
htmlToDom = new Map<String, Set<String>>(),
@@ -103,24 +89,33 @@ class HtmlDiff {
* should be initialized (via [parseOptions] and [initializeWorld]) and
* [HtmlDiff.initialize] should be called.
*/
- void run() {
- for (var libraryName in HTML_DECLARED_NAMES) {
- var library = _mirrors.libraries[libraryName];
- if (library == null) {
- warn('Could not find $libraryName');
- return;
- }
- for (ClassMirror type in library.classes.values) {
- final domTypes = htmlToDomTypes(type);
- if (domTypes.isEmpty) continue;
+ Future run(Path libDir) {
+ var result = new Completer();
+ var paths = <Path>[];
+ for (var libraryName in HTML_LIBRARY_NAMES) {
+ paths.add(new Path(libraryName));
+ }
+ analyze(paths, libDir).then((MirrorSystem mirrors) {
+ for (var libraryName in HTML_DECLARED_NAMES) {
+ var library = mirrors.libraries[libraryName];
+ if (library == null) {
+ warn('Could not find $libraryName');
+ result.complete(false);
+ }
+ for (ClassMirror type in library.classes.values) {
+ final domTypes = htmlToDomTypes(type);
+ if (domTypes.isEmpty) continue;
- htmlTypesToDom.putIfAbsent(type.qualifiedName,
- () => new Set()).addAll(domTypes);
+ htmlTypesToDom.putIfAbsent(type.qualifiedName,
+ () => new Set()).addAll(domTypes);
- type.members.forEach(
- (_, m) => _addMemberDiff(m, domTypes, library.simpleName));
+ type.members.forEach(
+ (_, m) => _addMemberDiff(m, domTypes, library.simpleName));
+ }
}
- }
+ result.complete(true);
+ });
+ return result.future;
}
/**
« no previous file with comments | « utils/apidoc/apidoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698