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

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: fixes compiler tests 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..f72214bfb52b2121edeea9314d037aaab06b1dec 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,18 @@ 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) {
ngeoffray 2013/10/18 10:19:37 Fits in previous line?
lukas 2013/10/24 16:48:36 Done.
+ SourceFile sourceFile;
+ String resourceUriString = resourceUri.toString();
+ if (data is List<int>) {
+ sourceFile = new Utf8BytesSourceFile(resourceUriString, data);
+ } else if (data is String) {
+ sourceFile = new StringSourceFile(resourceUriString, data);
+ } else {
+ String message = "Expected a 'String' or a 'List<int>' from the input "
+ "provider, but got: ${Error.safeToString(data)}.";
+ reportReadError(message);
+ }
// 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