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

Side by Side Diff: runtime/lib/core_patch.dart

Issue 1181663002: Add Resource class. (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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | runtime/lib/internal_patch.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:math"; 5 import "dart:math";
6 import "dart:typed_data"; 6 import "dart:typed_data";
7 import "dart:convert" show UTF8;
Ivan Posva 2015/06/12 10:51:03 Not needed. Please remove.
7 8
8 // Equivalent of calling FATAL from C++ code. 9 // Equivalent of calling FATAL from C++ code.
9 _fatal(msg) native "DartCore_fatal"; 10 _fatal(msg) native "DartCore_fatal";
10 11
11 // We need to pass the exception and stack trace objects as second and third 12 // We need to pass the exception and stack trace objects as second and third
12 // parameter to the continuation. See vm/ast_transformer.cc for usage. 13 // parameter to the continuation. See vm/ast_transformer.cc for usage.
13 void _asyncCatchHelper(catchFunction, continuation) { 14 void _asyncCatchHelper(catchFunction, continuation) {
14 catchFunction((e, s) => continuation(null, e, s)); 15 catchFunction((e, s) => continuation(null, e, s));
15 } 16 }
16 17
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (isYieldEach) { 199 if (isYieldEach) {
199 // Spec mandates: it is a dynamic error if the class of [the object 200 // Spec mandates: it is a dynamic error if the class of [the object
200 // returned by yield*] does not implement Iterable. 201 // returned by yield*] does not implement Iterable.
201 yieldEachIterator = (current as Iterable).iterator; 202 yieldEachIterator = (current as Iterable).iterator;
202 continue; 203 continue;
203 } 204 }
204 return true; 205 return true;
205 } 206 }
206 } 207 }
207 } 208 }
209
210 patch class Resource {
211 /* patch */ const factory Resource(String uri) = _Resource;
212 }
213
214 class _Resource implements Resource {
215 final String _location;
216
217 /* patch */ const _Resource(String uri) : _location = uri;
218
219 Uri get uri => Uri.base.resolve(_location);
220
221 Stream<List<int>> openRead() {
222 throw new UnimplementedError("openRead");
223 }
224
225 Future<List<int>> readAsBytes() {
226 throw new UnimplementedError("readAsBytes");
227 }
228
229 Future<String> readAsString({Encoding encoding}) {
230 throw new UnimplementedError("readAsString");
231 }
232 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | runtime/lib/internal_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698