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

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

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
Index: pkg/compiler/lib/src/source_file_provider.dart
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index cbc6ff3383cb5be3d3422cfebbf71900054185de..1b3b44b9e6171848a3af04df237b8d79c1486fa9 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -10,12 +10,14 @@ import 'dart:io';
import 'dart:math' as math;
import '../compiler.dart' as api show Diagnostic, DiagnosticHandler;
+import '../compiler_new.dart' as api show CompilerInput, CompilerDiagnostics;
import 'dart2js.dart' show AbortLeg;
import 'colors.dart' as colors;
import 'io/source_file.dart';
import 'filenames.dart';
import 'util/uri_extras.dart';
import 'dart:typed_data';
+import '../compiler_new.dart';
List<int> readAll(String filename) {
var file = (new File(filename)).openSync();
@@ -27,7 +29,7 @@ List<int> readAll(String filename) {
return buffer;
}
-abstract class SourceFileProvider {
+abstract class SourceFileProvider implements CompilerInput {
bool isWindows = (Platform.operatingSystem == 'windows');
Uri cwd = currentDirectory;
Map<Uri, SourceFile> sourceFiles = <Uri, SourceFile>{};
@@ -110,10 +112,14 @@ abstract class SourceFileProvider {
}
class CompilerSourceFileProvider extends SourceFileProvider {
- Future<List<int>> call(Uri resourceUri) => readUtf8BytesFromUri(resourceUri);
+
+ Future<List<int>> call(Uri resourceUri) => readFromUri(resourceUri);
Siggi Cherem (dart-lang) 2015/07/13 17:28:37 After we are done with the refactor, will we need
Johnni Winther 2015/07/13 17:45:19 These _are_ going away. Adding TODOs.
+
+ @override
+ Future readFromUri(Uri uri) => readUtf8BytesFromUri(uri);
}
-class FormattingDiagnosticHandler {
+class FormattingDiagnosticHandler implements CompilerDiagnostics {
final SourceFileProvider provider;
bool showWarnings = true;
bool showHints = true;
@@ -160,8 +166,9 @@ class FormattingDiagnosticHandler {
throw 'Unexpected diagnostic kind: $kind (${kind.ordinal})';
}
- void diagnosticHandler(Uri uri, int begin, int end, String message,
- api.Diagnostic kind) {
+ @override
+ void reportDiagnostic(Uri uri, int begin, int end, String message,
+ api.Diagnostic kind) {
// TODO(ahe): Remove this when source map is handled differently.
if (identical(kind.name, 'source map')) return;
@@ -224,7 +231,7 @@ class FormattingDiagnosticHandler {
}
void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) {
Siggi Cherem (dart-lang) 2015/07/13 17:28:37 same here
Johnni Winther 2015/07/13 19:02:22 Done.
- return diagnosticHandler(uri, begin, end, message, kind);
+ return reportDiagnostic(uri, begin, end, message, kind);
}
}

Powered by Google App Engine
This is Rietveld 408576698