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

Unified Diff: sdk/lib/_internal/dartdoc/lib/dartdoc.dart

Issue 12446003: Support full dart2js output for dartdoc/apidoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
Index: sdk/lib/_internal/dartdoc/lib/dartdoc.dart
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index e02d513c80443c220e803deb75dd64976fefd6e9..f0fe006ec5ac287c01809d41a273f66d2e080f20 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -29,7 +29,6 @@ import 'classify.dart';
import 'universe_serializer.dart';
import 'markdown.dart' as md;
import 'src/json_serializer.dart' as json_serializer;
-import '../../compiler/implementation/scanner/scannerlib.dart' as dart2js;
import '../../libraries.dart';
import 'src/dartdoc/nav.dart';
@@ -133,12 +132,13 @@ Future<bool> compileScript(int mode, Path outputDir, Path libPath) {
var jsPath = outputDir.append('client-$clientScript.js');
var completer = new Completer<bool>();
- var compilation = new Compilation(
- dartPath, libPath, null, const <String>['--categories=Client,Server']);
- Future<String> result = compilation.compileToJavaScript();
+ Future<String> result = dart2js.compile(
+ dartPath, libPath, options: const <String>['--categories=Client,Server']);
ahe 2013/03/05 14:48:31 Is the --categories option needed here?
Johnni Winther 2013/03/06 08:13:11 Yes. It also finds 'ssa/tracer.dart'. Will investi
result.then((jsCode) {
- writeString(new File.fromPath(jsPath), jsCode);
- completer.complete(true);
+ if (jsCode != null) {
+ writeString(new File.fromPath(jsPath), jsCode);
+ }
+ completer.complete(jsCode != null);
});
result.catchError((e) => completer.completeError(e.error, e.stackTrace));
return completer.future;
@@ -371,22 +371,28 @@ class Dartdoc {
return content;
}
- void documentEntryPoint(Path entrypoint, Path libPath, Path pkgPath) {
- final compilation = new Compilation(entrypoint, libPath, pkgPath,
- COMPILER_OPTIONS);
- _document(compilation);
+ Future documentEntryPoint(Path entrypoint, Path libPath, Path pkgPath) {
+ return documentLibraries(<Path>[entrypoint], libPath, pkgPath);
}
- void documentLibraries(List<Path> libraryList, Path libPath, Path pkgPath) {
- final compilation = new Compilation.library(libraryList, libPath, pkgPath,
- COMPILER_OPTIONS);
- _document(compilation);
+ Future documentLibraries(List<Path> libraryList,
+ Path libPath, Path pkgPath) {
ahe 2013/03/05 14:48:31 Indentation.
Johnni Winther 2013/03/06 08:13:11 Done.
+ Completer completer = new Completer();
+ Future<MirrorSystem> result = dart2js.analyze(libraryList, libPath,
+ packageRoot: pkgPath, options: COMPILER_OPTIONS);
+ result.then((MirrorSystem mirrors) {
+ _document(mirrors);
+ completer.complete(true);
+ }, onError: (AsyncError error) {
+ completer.completeError(error.error);
+ });
+ return completer.future;
}
- void _document(Compilation compilation) {
+ void _document(MirrorSystem mirrors) {
// Sort the libraries by name (not key).
_sortedLibraries = new List<LibraryMirror>.from(
- compilation.mirrors.libraries.values.where(shouldIncludeLibrary));
+ mirrors.libraries.values.where(shouldIncludeLibrary));
_sortedLibraries.sort((x, y) {
return displayName(x).toUpperCase().compareTo(
displayName(y).toUpperCase());
@@ -443,7 +449,7 @@ class Dartdoc {
write(json_serializer.serialize(packageManifest));
endFile();
}
-
+
MdnComment lookupMdnComment(Mirror mirror) => null;
void startFile(String path) {

Powered by Google App Engine
This is Rietveld 408576698