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

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

Issue 824103005: Revert "Remove Compiler.assembledCode." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/src/compiler.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 3db762d3e780c341f3d7b62cb0647a14350116f4..82b8c3b85b42f5ffd88908b3c65bb0528f7c4ca7 100644
--- a/pkg/compiler/lib/compiler.dart
+++ b/pkg/compiler/lib/compiler.dart
@@ -65,21 +65,6 @@ typedef EventSink<String> CompilerOutputProvider(String name,
typedef void DiagnosticHandler(Uri uri, int begin, int end,
String message, Diagnostic kind);
-/// Information resulting from the compilation.
-class CompilationResult {
- /// `true` if the compilation succeeded, that is, compilation didn't fail due
- /// to compile-time errors and/or internal errors.
- final bool isSuccess;
-
- /// The compiler object used for the compilation.
- ///
- /// Note: The type of [compiler] is implementation dependent and may vary.
- /// Use only for debugging and testing.
- final compiler;
-
- CompilationResult(this.compiler, {this.isSuccess: true});
-}
-
/**
* Returns a future that completes to a non-null String when [script]
* has been successfully compiled.
@@ -95,15 +80,14 @@ class CompilationResult {
* as the compiler may create multiple files to support lazy loading
* of libraries.
*/
-Future<CompilationResult> compile(
- Uri script,
- Uri libraryRoot,
- Uri packageRoot,
- CompilerInputProvider inputProvider,
- DiagnosticHandler handler,
- [List<String> options = const [],
- CompilerOutputProvider outputProvider,
- Map<String, dynamic> environment = const {}]) {
+Future<String> compile(Uri script,
+ Uri libraryRoot,
+ Uri packageRoot,
+ CompilerInputProvider inputProvider,
+ DiagnosticHandler handler,
+ [List<String> options = const [],
+ CompilerOutputProvider outputProvider,
+ Map<String, dynamic> environment = const {}]) {
if (!libraryRoot.path.endsWith("/")) {
throw new ArgumentError("libraryRoot must end with a /");
}
@@ -119,8 +103,13 @@ Future<CompilationResult> compile(
packageRoot,
options,
environment);
- return compiler.run(script).then((bool success) {
- return new CompilationResult(compiler, isSuccess: success);
+ // TODO(ahe): Use the value of the future (which signals success or failure).
+ return compiler.run(script).then((_) {
+ String code = compiler.assembledCode;
+ if (code != null && outputProvider != null) {
+ code = ''; // Non-null signals success.
+ }
+ return code;
});
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698