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

Unified Diff: sdk/lib/_internal/compiler/implementation/apiimpl.dart

Issue 27510003: Scanner for UTF-8 byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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: sdk/lib/_internal/compiler/implementation/apiimpl.dart
diff --git a/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index 2b56ac00003095c547ef53a3d9f48f088646d33d..72f05a1c835e05e20f0af78b1731b39ad1b36f0e 100644
--- a/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -15,7 +15,7 @@ import '../../libraries.dart';
import 'source_file.dart';
class Compiler extends leg.Compiler {
- api.ReadStringFromUri provider;
+ api.CompilerInputProvider provider;
api.DiagnosticHandler handler;
final Uri libraryRoot;
final Uri packageRoot;
@@ -176,8 +176,16 @@ class Compiler extends leg.Compiler {
// [Future] to ensure that we never execute an asynchronous action without setting
// up the current element of the compiler.
return new Future.sync(() => callUserProvider(resourceUri))
- .then((String text) {
- SourceFile sourceFile = new SourceFile(resourceUri.toString(), text);
+ .then((data) {
+ SourceFile sourceFile;
+ if (data is List<int>) {
+ sourceFile = new Utf8BytesSourceFile(resourceUri.toString(), data);
+ } else if (data is String) {
+ sourceFile = new StringSourceFile(resourceUri.toString(), data);
+ } else {
+ String tp = data.runtimeType.toString();
ahe 2013/10/16 14:26:04 Please don't abbreviate. Also, don't use runtimeTy
lukas 2013/10/17 07:21:25 Done.
+ reportReadError("The CompilerInputProvider returned a $tp.");
ahe 2013/10/16 14:26:04 This error message should be something like: "Exp
lukas 2013/10/17 07:21:25 How do I do that?
+ }
// We use [readableUri] as the URI for the script since need to preserve
// the scheme in the script because [Script.uri] is used for resolving
// relative URIs mentioned in the script. See the comment on

Powered by Google App Engine
This is Rietveld 408576698