Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3152)

Unified Diff: pkg/compiler/lib/compiler.dart

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/compiler_new.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/compiler.dart
diff --git a/pkg/compiler/lib/compiler.dart b/pkg/compiler/lib/compiler.dart
index 710ad444d61a817b96096f7ab408a60bdff77980..763dc4a908235c3890c302cc80990e992d8c5a67 100644
--- a/pkg/compiler/lib/compiler.dart
+++ b/pkg/compiler/lib/compiler.dart
@@ -6,7 +6,8 @@ library compiler;
import 'dart:async';
import 'package:package_config/packages.dart';
-import 'src/apiimpl.dart';
+import 'compiler_new.dart' as new_api;
+import 'src/old_to_new_api.dart';
// Unless explicitly allowed, passing [:null:] for any argument to the
// methods of library will result in an Error being thrown.
@@ -113,25 +114,26 @@ Future<CompilationResult> compile(
Map<String, dynamic> environment = const {},
Uri packageConfig,
PackagesDiscoveryProvider packagesDiscoveryProvider]) {
- if (!libraryRoot.path.endsWith("/")) {
- throw new ArgumentError("libraryRoot must end with a /");
- }
- if (packageRoot != null && !packageRoot.path.endsWith("/")) {
- throw new ArgumentError("packageRoot must end with a /");
- }
- // TODO(ahe): Consider completing the future with an exception if
- // code is null.
- Compiler compiler = new Compiler(inputProvider,
- outputProvider,
- handler,
- libraryRoot,
- packageRoot,
- options,
- environment,
- packageConfig,
- packagesDiscoveryProvider);
- return compiler.run(script).then((bool success) {
- return new CompilationResult(compiler, isSuccess: success);
+
+ new_api.CompilerOptions compilerOptions = new new_api.CompilerOptions(
+ entryPoint: script,
+ libraryRoot: libraryRoot,
+ packageRoot: packageRoot,
+ packageConfig: packageConfig,
+ packagesDiscoveryProvider: packagesDiscoveryProvider,
+ options: options,
+ environment: environment);
+
+ new_api.CompilerInput compilerInput = new LegacyCompilerInput(inputProvider);
+ new_api.CompilerDiagnostics compilerDiagnostics =
+ new LegacyCompilerDiagnostics(handler);
+ new_api.CompilerOutput compilerOutput =
+ new LegacyCompilerOutput(outputProvider);
+
+ return new_api.compile(compilerOptions, compilerInput,
+ compilerDiagnostics, compilerOutput)
+ .then((new_api.CompilationResult result) {
+ return new CompilationResult(result.compiler, isSuccess: result.isSuccess);
});
}
« no previous file with comments | « no previous file | pkg/compiler/lib/compiler_new.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698