| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// New Compiler API. This API is under construction, use only internally or | 5 /// New Compiler API. This API is under construction, use only internally or |
| 6 /// in unittests. | 6 /// in unittests. |
| 7 | 7 |
| 8 library compiler_new; | 8 library compiler_new; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /// Interface for receiving diagnostic message from the compiler. That is, | 60 /// Interface for receiving diagnostic message from the compiler. That is, |
| 61 /// errors, warnings, hints, etc. | 61 /// errors, warnings, hints, etc. |
| 62 abstract class CompilerDiagnostics { | 62 abstract class CompilerDiagnostics { |
| 63 /// Invoked by the compiler to report diagnostics. If [uri] is `null`, so are | 63 /// Invoked by the compiler to report diagnostics. If [uri] is `null`, so are |
| 64 /// [begin] and [end]. No other arguments may be `null`. If [uri] is not | 64 /// [begin] and [end]. No other arguments may be `null`. If [uri] is not |
| 65 /// `null`, neither are [begin] and [end]. [uri] indicates the compilation | 65 /// `null`, neither are [begin] and [end]. [uri] indicates the compilation |
| 66 /// unit from where the diagnostic originates. [begin] and [end] are | 66 /// unit from where the diagnostic originates. [begin] and [end] are |
| 67 /// zero-based character offsets from the beginning of the compilation unit. | 67 /// zero-based character offsets from the beginning of the compilation unit. |
| 68 /// [message] is the diagnostic message, and [kind] indicates indicates what | 68 /// [message] is the diagnostic message, and [kind] indicates indicates what |
| 69 /// kind of diagnostic it is. | 69 /// kind of diagnostic it is. |
| 70 void report(Uri uri, int begin, int end, String message, Diagnostic kind); | 70 /// |
| 71 /// Experimental: [code] gives access to an id for the messages. Currently it |
| 72 /// is the [Message] used to create the diagnostic, if available, from which |
| 73 /// the [MessageKind] is accessible. |
| 74 void report(var code, |
| 75 Uri uri, int begin, int end, String text, Diagnostic kind); |
| 71 } | 76 } |
| 72 | 77 |
| 73 /// Information resulting from the compilation. | 78 /// Information resulting from the compilation. |
| 74 class CompilationResult { | 79 class CompilationResult { |
| 75 /// `true` if the compilation succeeded, that is, compilation didn't fail due | 80 /// `true` if the compilation succeeded, that is, compilation didn't fail due |
| 76 /// to compile-time errors and/or internal errors. | 81 /// to compile-time errors and/or internal errors. |
| 77 final bool isSuccess; | 82 final bool isSuccess; |
| 78 | 83 |
| 79 /// The compiler object used for the compilation. | 84 /// The compiler object used for the compilation. |
| 80 /// | 85 /// |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 compilerOptions.libraryRoot, | 175 compilerOptions.libraryRoot, |
| 171 compilerOptions.packageRoot, | 176 compilerOptions.packageRoot, |
| 172 compilerOptions.options, | 177 compilerOptions.options, |
| 173 compilerOptions.environment, | 178 compilerOptions.environment, |
| 174 compilerOptions.packageConfig, | 179 compilerOptions.packageConfig, |
| 175 compilerOptions.packagesDiscoveryProvider); | 180 compilerOptions.packagesDiscoveryProvider); |
| 176 return compiler.run(compilerOptions.entryPoint).then((bool success) { | 181 return compiler.run(compilerOptions.entryPoint).then((bool success) { |
| 177 return new CompilationResult(compiler, isSuccess: success); | 182 return new CompilationResult(compiler, isSuccess: success); |
| 178 }); | 183 }); |
| 179 } | 184 } |
| OLD | NEW |