Chromium Code Reviews| 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 |