| 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'; |
| 11 | 11 |
| 12 // TODO(sigmund): move loader logic under front_end/lib/src/kernel/ | 12 // TODO(sigmund): move loader logic under front_end/lib/src/kernel/ |
| 13 import 'package:kernel/analyzer/loader.dart'; | 13 import 'package:kernel/analyzer/loader.dart'; |
| 14 import 'package:kernel/kernel.dart'; | 14 import 'package:kernel/kernel.dart'; |
| 15 import 'package:source_span/source_span.dart' show SourceSpan; |
| 15 | 16 |
| 16 /// Generates a kernel representation of the program whose main library is in | 17 /// Generates a kernel representation of the program whose main library is in |
| 17 /// the given [source]. | 18 /// the given [source]. |
| 18 /// | 19 /// |
| 19 /// Intended for whole program (non-modular) compilation. | 20 /// Intended for whole program (non-modular) compilation. |
| 20 /// | 21 /// |
| 21 /// Given the Uri of a file containing a program's `main` method, this function | 22 /// Given the Uri of a file containing a program's `main` method, this function |
| 22 /// follows `import`, `export`, and `part` declarations to discover the whole | 23 /// follows `import`, `export`, and `part` declarations to discover the whole |
| 23 /// program, and converts the result to Dart Kernel format. | 24 /// program, and converts the result to Dart Kernel format. |
| 24 /// | 25 /// |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (onError == null) return; | 92 if (onError == null) return; |
| 92 for (var error in errors) { | 93 for (var error in errors) { |
| 93 onError(new _DartkError(error)); | 94 onError(new _DartkError(error)); |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 | 97 |
| 97 // TODO(sigmund): delete this class. Dartk should not format errors itself, we | 98 // TODO(sigmund): delete this class. Dartk should not format errors itself, we |
| 98 // should just pass them along. | 99 // should just pass them along. |
| 99 class _DartkError implements CompilationError { | 100 class _DartkError implements CompilationError { |
| 100 String get correction => null; | 101 String get correction => null; |
| 101 String get span => null; | 102 SourceSpan get span => null; |
| 102 final String message; | 103 final String message; |
| 103 _DartkError(this.message); | 104 _DartkError(this.message); |
| 104 } | 105 } |
| OLD | NEW |