| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 sourceFiles[resourceUri] = | 96 sourceFiles[resourceUri] = |
| 97 new CachingUtf8BytesSourceFile( | 97 new CachingUtf8BytesSourceFile( |
| 98 resourceUri, resourceUri.toString(), result); | 98 resourceUri, resourceUri.toString(), result); |
| 99 return result; | 99 return result; |
| 100 }); | 100 }); |
| 101 } | 101 } |
| 102 | 102 |
| 103 Future/*<List<int> | String>*/ call(Uri resourceUri); | 103 Future/*<List<int> | String>*/ call(Uri resourceUri); |
| 104 | 104 |
| 105 relativizeUri(Uri uri) => relativize(cwd, uri, isWindows); | 105 relativizeUri(Uri uri) => relativize(cwd, uri, isWindows); |
| 106 |
| 107 SourceFile getSourceFile(Uri resourceUri) { |
| 108 return sourceFiles[resourceUri]; |
| 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 class CompilerSourceFileProvider extends SourceFileProvider { | 112 class CompilerSourceFileProvider extends SourceFileProvider { |
| 109 Future<List<int>> call(Uri resourceUri) => readUtf8BytesFromUri(resourceUri); | 113 Future<List<int>> call(Uri resourceUri) => readUtf8BytesFromUri(resourceUri); |
| 110 } | 114 } |
| 111 | 115 |
| 112 class FormattingDiagnosticHandler { | 116 class FormattingDiagnosticHandler { |
| 113 final SourceFileProvider provider; | 117 final SourceFileProvider provider; |
| 114 bool showWarnings = true; | 118 bool showWarnings = true; |
| 115 bool showHints = true; | 119 bool showHints = true; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 var onAdd, onClose; | 325 var onAdd, onClose; |
| 322 | 326 |
| 323 EventSinkWrapper(this.onAdd, this.onClose); | 327 EventSinkWrapper(this.onAdd, this.onClose); |
| 324 | 328 |
| 325 void add(String data) => onAdd(data); | 329 void add(String data) => onAdd(data); |
| 326 | 330 |
| 327 void addError(error, [StackTrace stackTrace]) => throw error; | 331 void addError(error, [StackTrace stackTrace]) => throw error; |
| 328 | 332 |
| 329 void close() => onClose(); | 333 void close() => onClose(); |
| 330 } | 334 } |
| OLD | NEW |