| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Defines the front-end API for converting source code to Dart Kernel objects. | 5 /// Defines the front-end API for converting source code to Dart Kernel objects. |
| 6 library front_end.kernel_generator; | 6 library front_end.kernel_generator; |
| 7 | 7 |
| 8 import 'compilation_error.dart'; | 8 import 'compilation_error.dart'; |
| 9 import 'compiler_options.dart'; | 9 import 'compiler_options.dart'; |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 void _reportErrors(List errors, ErrorHandler onError) { | 176 void _reportErrors(List errors, ErrorHandler onError) { |
| 177 if (onError == null) return; | 177 if (onError == null) return; |
| 178 for (var error in errors) { | 178 for (var error in errors) { |
| 179 onError(new _DartkError(error)); | 179 onError(new _DartkError(error)); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 String _uriToPath(Uri uri, CompilerOptions options) { | 183 String _uriToPath(Uri uri, CompilerOptions options) { |
| 184 if (uri == null) return null; | 184 if (uri == null) return null; |
| 185 if (uri.scheme != 'file') { | 185 if (uri.scheme != 'file') { |
| 186 throw new StateError('Only file URIs are supported'); | 186 throw new StateError('Only file URIs are supported: $uri'); |
| 187 } | 187 } |
| 188 return options.fileSystem.context.fromUri(uri); | 188 return options.fileSystem.context.fromUri(uri); |
| 189 } | 189 } |
| 190 | 190 |
| 191 // TODO(sigmund): delete this class. Dartk should not format errors itself, we | 191 // TODO(sigmund): delete this class. Dartk should not format errors itself, we |
| 192 // should just pass them along. | 192 // should just pass them along. |
| 193 class _DartkError implements CompilationError { | 193 class _DartkError implements CompilationError { |
| 194 String get correction => null; | 194 String get correction => null; |
| 195 SourceSpan get span => null; | 195 SourceSpan get span => null; |
| 196 final String message; | 196 final String message; |
| 197 _DartkError(this.message); | 197 _DartkError(this.message); |
| 198 } | 198 } |
| OLD | NEW |