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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/source_file_provider.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: Updated cf. comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 library source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 20 matching lines...) Expand all
31 int dartCharactersRead = 0; 31 int dartCharactersRead = 0;
32 32
33 Future<String> readStringFromUri(Uri resourceUri) { 33 Future<String> readStringFromUri(Uri resourceUri) {
34 if (resourceUri.scheme != 'file') { 34 if (resourceUri.scheme != 'file') {
35 throw new ArgumentError("Unknown scheme in uri '$resourceUri'"); 35 throw new ArgumentError("Unknown scheme in uri '$resourceUri'");
36 } 36 }
37 String source; 37 String source;
38 try { 38 try {
39 source = readAll(uriPathToNative(resourceUri.path)); 39 source = readAll(uriPathToNative(resourceUri.path));
40 } on FileException catch (ex) { 40 } on FileException catch (ex) {
41 throw "Error reading '${relativize(cwd, resourceUri, isWindows)}' " 41 return new Future.error(
42 "(${ex.osError})"; 42 "Error reading '${relativize(cwd, resourceUri, isWindows)}' "
43 "(${ex.osError})");
43 } 44 }
44 dartCharactersRead += source.length; 45 dartCharactersRead += source.length;
45 sourceFiles[resourceUri.toString()] = new SourceFile( 46 sourceFiles[resourceUri.toString()] = new SourceFile(
46 relativize(cwd, resourceUri, isWindows), source); 47 relativize(cwd, resourceUri, isWindows), source);
47 return new Future.value(source); 48 return new Future.value(source);
48 } 49 }
49 50
50 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri); 51 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri);
51 } 52 }
52 53
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (fatal && throwOnError) { 132 if (fatal && throwOnError) {
132 isAborting = true; 133 isAborting = true;
133 throw new AbortLeg(message); 134 throw new AbortLeg(message);
134 } 135 }
135 } 136 }
136 137
137 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { 138 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) {
138 return diagnosticHandler(uri, begin, end, message, kind); 139 return diagnosticHandler(uri, begin, end, message, kind);
139 } 140 }
140 } 141 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/patch_parser.dart ('k') | sdk/lib/_internal/compiler/implementation/util/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698