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:io'; | 8 import 'dart:io'; |
9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 var buffer = new Uint8List(bufferLength); | 124 var buffer = new Uint8List(bufferLength); |
125 file.readIntoSync(buffer, 0, length); | 125 file.readIntoSync(buffer, 0, length); |
126 file.closeSync(); | 126 file.closeSync(); |
127 return buffer; | 127 return buffer; |
128 } | 128 } |
129 | 129 |
130 class CompilerSourceFileProvider extends SourceFileProvider { | 130 class CompilerSourceFileProvider extends SourceFileProvider { |
131 // TODO(johnniwinther): Remove this when no longer needed for the old compiler | 131 // TODO(johnniwinther): Remove this when no longer needed for the old compiler |
132 // API. | 132 // API. |
133 Future<List<int>> call(Uri resourceUri) => readFromUri(resourceUri); | 133 Future<List<int>> call(Uri resourceUri) => |
| 134 readFromUri(resourceUri).then((input) => input.data); |
134 | 135 |
135 @override | 136 @override |
136 Future readFromUri(Uri uri, {InputKind inputKind: InputKind.utf8}) => | 137 Future<api.Input<List<int>>> readFromUri(Uri uri, |
| 138 {InputKind inputKind: InputKind.utf8}) => |
137 readBytesFromUri(uri, inputKind); | 139 readBytesFromUri(uri, inputKind); |
138 } | 140 } |
139 | 141 |
140 class FormattingDiagnosticHandler implements CompilerDiagnostics { | 142 class FormattingDiagnosticHandler implements CompilerDiagnostics { |
141 final SourceFileProvider provider; | 143 final SourceFileProvider provider; |
142 bool showWarnings = true; | 144 bool showWarnings = true; |
143 bool showHints = true; | 145 bool showHints = true; |
144 bool verbose = false; | 146 bool verbose = false; |
145 bool isAborting = false; | 147 bool isAborting = false; |
146 bool enableColors = false; | 148 bool enableColors = false; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 resolvedUri = file; | 443 resolvedUri = file; |
442 break; | 444 break; |
443 } | 445 } |
444 } | 446 } |
445 } | 447 } |
446 api.Input result = await readBytesFromUri(resolvedUri, inputKind); | 448 api.Input result = await readBytesFromUri(resolvedUri, inputKind); |
447 sourceFiles[uri] = sourceFiles[resolvedUri]; | 449 sourceFiles[uri] = sourceFiles[resolvedUri]; |
448 return result; | 450 return result; |
449 } | 451 } |
450 } | 452 } |
OLD | NEW |