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

Unified Diff: sdk/lib/_internal/compiler/js_lib/core_patch.dart

Issue 1193273003: Revert "Add Resource class. Currently unimplemented." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « runtime/lib/internal_patch.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/js_lib/core_patch.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/core_patch.dart b/sdk/lib/_internal/compiler/js_lib/core_patch.dart
index 4e2e714ed5df6cdcdc6b5c64bb8e45b96b9eeca4..7045e05f906283ba58a821eb47178164298de357 100644
--- a/sdk/lib/_internal/compiler/js_lib/core_patch.dart
+++ b/sdk/lib/_internal/compiler/js_lib/core_patch.dart
@@ -510,71 +510,3 @@ class Uri {
throw new UnsupportedError("'Uri.base' is not supported");
}
}
-
-@patch
-class Resource {
- @patch
- const factory Resource(String uri) = _Resource;
-}
-
-Uri _resolvePackageUri(Uri packageUri) {
- assert(packageUri.scheme == "package");
- if (packageUri.hasAuthority) {
- throw new ArgumentError("Package-URI must not have a host: $packageUri");
- }
- var resolved = Uri.base.resolve("packages/${packageUri.path}");
- return resolved;
-}
-
-class _Resource implements Resource {
- final String _location;
-
- const _Resource(String uri) : _location = uri;
-
- Uri get uri => Uri.base.resolve(_location);
-
- Stream<List<int>> openRead() {
- Uri uri = this.uri;
- if (uri.scheme == "package") {
- uri = _resolvePackageUri(uri);
- }
- if (uri.scheme == "http" || uri.scheme == "https") {
- return _readAsStream(uri);
- }
- throw new StateError("Unable to find resource, unknown scheme: $_location");
- }
-
- Future<List<int>> readAsBytes() {
- Uri uri = this.uri;
- if (uri.scheme == "package") {
- uri = _resolvePackageUri(uri);
- }
- if (uri.scheme == "http" || uri.scheme == "https") {
- return _readAsBytes(uri);
- }
- throw new StateError("Unable to find resource, unknown scheme: $_location");
- }
-
- Future<String> readAsString({Encoding encoding: UTF8}) {
- Uri uri = this.uri;
- if (uri.scheme == "package") {
- uri = _resolvePackageUri(uri);
- }
- if (uri.scheme == "http" || uri.scheme == "https") {
- return _readAsString(uri);
- }
- throw new StateError("Unable to find resource, unknown scheme: $_location");
- }
-
- Stream<List<int>> _readAsStream(Uri uri) {
- throw new UnimplementedError("Streaming bytes via HTTP");
- }
-
- Future<List<int>> _readAsBytes(Uri uri) {
- throw new UnimplementedError("Reading bytes via HTTP");
- }
-
- Future<String> _readAsString(Uri uri) {
- throw new UnimplementedError("Reading string via HTTP");
- }
-}
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698