| 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'; |
| 11 |
| 12 import 'compiler.dart' show Diagnostic; |
| 11 import 'src/apiimpl.dart'; | 13 import 'src/apiimpl.dart'; |
| 12 import 'src/options.dart' show CompilerOptions; | 14 import 'src/options.dart' show CompilerOptions; |
| 13 | 15 |
| 14 import 'compiler.dart' show Diagnostic; | |
| 15 export 'compiler.dart' show Diagnostic, PackagesDiscoveryProvider; | 16 export 'compiler.dart' show Diagnostic, PackagesDiscoveryProvider; |
| 16 | 17 |
| 17 // Unless explicitly allowed, passing `null` for any argument to the | 18 // Unless explicitly allowed, passing `null` for any argument to the |
| 18 // methods of library will result in an Error being thrown. | 19 // methods of library will result in an Error being thrown. |
| 19 | 20 |
| 20 /// Interface for providing the compiler with input. That is, Dart source files, | 21 /// Interface for providing the compiler with input. That is, Dart source files, |
| 21 /// package config files, etc. | 22 /// package config files, etc. |
| 22 abstract class CompilerInput { | 23 abstract class CompilerInput { |
| 23 /// Returns a future that completes to the source corresponding to [uri]. | 24 /// Returns a future that completes to the source corresponding to [uri]. |
| 24 /// If an exception occurs, the future completes with this exception. | 25 /// If an exception occurs, the future completes with this exception. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (compilerOutput == null) { | 119 if (compilerOutput == null) { |
| 119 throw new ArgumentError("compilerOutput must be non-null"); | 120 throw new ArgumentError("compilerOutput must be non-null"); |
| 120 } | 121 } |
| 121 | 122 |
| 122 CompilerImpl compiler = new CompilerImpl( | 123 CompilerImpl compiler = new CompilerImpl( |
| 123 compilerInput, compilerOutput, compilerDiagnostics, compilerOptions); | 124 compilerInput, compilerOutput, compilerDiagnostics, compilerOptions); |
| 124 return compiler.run(compilerOptions.entryPoint).then((bool success) { | 125 return compiler.run(compilerOptions.entryPoint).then((bool success) { |
| 125 return new CompilationResult(compiler, isSuccess: success); | 126 return new CompilationResult(compiler, isSuccess: success); |
| 126 }); | 127 }); |
| 127 } | 128 } |
| OLD | NEW |