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

Unified Diff: pkg/compiler/lib/src/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 | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 0cc5a67947448aa112ddb1903141d2617f098970..447be5fa202c2f117415961f4e563ae0d9fc773d 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -792,7 +792,7 @@ abstract class Compiler implements DiagnosticListener {
final bool allowNativeExtensions;
/// Output provider from user of Compiler API.
- api.CompilerOutputProvider userOutputProvider;
+ api.CompilerOutput userOutputProvider;
/// Generate output even when there are compile-time errors.
final bool generateCodeWithCompileTimeErrors;
@@ -1061,7 +1061,7 @@ abstract class Compiler implements DiagnosticListener {
this.allowNativeExtensions: false,
this.generateCodeWithCompileTimeErrors: false,
this.testMode: false,
- api.CompilerOutputProvider outputProvider,
+ api.CompilerOutput outputProvider,
List<String> strips: const []})
: this.disableTypeInferenceFlag =
disableTypeInferenceFlag || !emitJavaScript,
@@ -1071,9 +1071,8 @@ abstract class Compiler implements DiagnosticListener {
this.analyzeAllFlag = analyzeAllFlag,
this.hasIncrementalSupport = hasIncrementalSupport,
cacheStrategy = new CacheStrategy(hasIncrementalSupport),
- this.userOutputProvider = (outputProvider == null)
- ? NullSink.outputProvider
- : outputProvider {
+ this.userOutputProvider = outputProvider == null
+ ? const NullCompilerOutput() : outputProvider {
if (hasIncrementalSupport) {
// TODO(ahe): This is too much. Any method from platform and package
// libraries can be inlined.
@@ -2170,7 +2169,7 @@ abstract class Compiler implements DiagnosticListener {
return new NullSink('$name.$extension');
}
}
- return userOutputProvider(name, extension);
+ return userOutputProvider.createEventSink(name, extension);
}
}
@@ -2304,26 +2303,6 @@ bool isPrivateName(String s) => !s.isEmpty && s.codeUnitAt(0) == $_;
/// Returns `true` when [s] is public if used as an identifier.
bool isPublicName(String s) => !isPrivateName(s);
-/// A sink that drains into /dev/null.
-class NullSink implements EventSink<String> {
- final String name;
-
- NullSink(this.name);
-
- add(String value) {}
-
- void addError(Object error, [StackTrace stackTrace]) {}
-
- void close() {}
-
- toString() => name;
-
- /// Convenience method for getting an [api.CompilerOutputProvider].
- static NullSink outputProvider(String name, String extension) {
- return new NullSink('$name.$extension');
- }
-}
-
/// Information about suppressed warnings and hints for a given library.
class SuppressionInfo {
int warnings = 0;
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698