| OLD | NEW |
| 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 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 dartCharactersRead += totalLength; | 82 dartCharactersRead += totalLength; |
| 83 sourceFiles[resourceUri] = new CachingUtf8BytesSourceFile( | 83 sourceFiles[resourceUri] = new CachingUtf8BytesSourceFile( |
| 84 resourceUri, resourceUri.toString(), result); | 84 resourceUri, resourceUri.toString(), result); |
| 85 return result; | 85 return result; |
| 86 }); | 86 }); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // TODO(johnniwinther): Remove this when no longer needed for the old compiler | 89 // TODO(johnniwinther): Remove this when no longer needed for the old compiler |
| 90 // API. | 90 // API. |
| 91 Future/*<List<int> | String>*/ call(Uri resourceUri) => throw "unimplemented"; | 91 Future /* <List<int> | String> */ call(Uri resourceUri) { |
| 92 throw "unimplemented"; |
| 93 } |
| 92 | 94 |
| 93 relativizeUri(Uri uri) => relativize(cwd, uri, isWindows); | 95 relativizeUri(Uri uri) => relativize(cwd, uri, isWindows); |
| 94 | 96 |
| 95 SourceFile getSourceFile(Uri resourceUri) { | 97 SourceFile getSourceFile(Uri resourceUri) { |
| 96 return sourceFiles[resourceUri]; | 98 return sourceFiles[resourceUri]; |
| 97 } | 99 } |
| 98 } | 100 } |
| 99 | 101 |
| 100 List<int> readAll(String filename) { | 102 List<int> readAll(String filename) { |
| 101 var file = (new File(filename)).openSync(); | 103 var file = (new File(filename)).openSync(); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 resolvedUri = file; | 414 resolvedUri = file; |
| 413 break; | 415 break; |
| 414 } | 416 } |
| 415 } | 417 } |
| 416 } | 418 } |
| 417 var result = await readUtf8BytesFromUri(resolvedUri); | 419 var result = await readUtf8BytesFromUri(resolvedUri); |
| 418 sourceFiles[uri] = sourceFiles[resolvedUri]; | 420 sourceFiles[uri] = sourceFiles[resolvedUri]; |
| 419 return result; | 421 return result; |
| 420 } | 422 } |
| 421 } | 423 } |
| OLD | NEW |