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) { |