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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove withCurrentElementAsync Created 7 years, 5 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/compiler/implementation/dart2js.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart2js.dart b/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 55812c0c6d932efd846d82de38cd91cafe254e7c..328c1d5e1af5126d9035d7edd6062aa62d817407 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -91,7 +91,7 @@ void parseCommandLine(List<OptionHandler> handlers, List<String> argv) {
}
}
-void compile(List<String> argv) {
+Future compile(List<String> argv) {
bool isWindows = (Platform.operatingSystem == 'windows');
stackTraceFilePrefix = '$currentDirectory';
Uri libraryRoot = currentDirectory;
@@ -388,10 +388,10 @@ void compile(List<String> argv) {
return new EventSinkWrapper(writeStringSync, onDone);
}
- api.compile(uri, libraryRoot, packageRoot,
+ return api.compile(uri, libraryRoot, packageRoot,
inputProvider.readStringFromUri, handler,
options, outputProvider)
- .then(compilationDone);
+ .then(compilationDone);
}
class EventSinkWrapper extends EventSink<String> {
@@ -426,11 +426,11 @@ void fail(String message) {
exit(1);
}
-void compilerMain(Options options) {
+Future compilerMain(Options options) {
var root = uriPathToNative("/$LIBRARY_ROOT");
List<String> argv = ['--library-root=${options.script}$root'];
argv.addAll(options.arguments);
- compile(argv);
+ return compile(argv);
}
void help() {
@@ -577,20 +577,22 @@ void helpAndFail(String message) {
}
void mainWithErrorHandler(Options options) {
- try {
- compilerMain(options);
- } catch (exception, trace) {
+ compilerMain(options).catchError((exception) {
try {
print('Internal error: $exception');
} catch (ignored) {
print('Internal error: error while printing exception');
}
+
try {
- print(trace);
+ var trace = getAttachedStackTrace(exception);
+ if (trace != null) {
+ print(trace);
+ }
} finally {
exit(253); // 253 is recognized as a crash by our test scripts.
}
- }
+ });
}
void main() {

Powered by Google App Engine
This is Rietveld 408576698