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

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 15689009: Type check try statements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename variable. Created 7 years, 7 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 | Annotate | Revision Log
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 part of dart.io; 5 part of dart.io;
6 6
7 // Read the file in blocks of size 64k. 7 // Read the file in blocks of size 64k.
8 const int _BLOCK_SIZE = 64 * 1024; 8 const int _BLOCK_SIZE = 64 * 1024;
9 9
10 10
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 List<String> readAsLinesSync({Encoding encoding: Encoding.UTF_8}) { 527 List<String> readAsLinesSync({Encoding encoding: Encoding.UTF_8}) {
528 return _decodeLines(readAsBytesSync(), encoding); 528 return _decodeLines(readAsBytesSync(), encoding);
529 } 529 }
530 530
531 Future<File> writeAsBytes(List<int> bytes, 531 Future<File> writeAsBytes(List<int> bytes,
532 {FileMode mode: FileMode.WRITE}) { 532 {FileMode mode: FileMode.WRITE}) {
533 try { 533 try {
534 IOSink sink = openWrite(mode: mode); 534 IOSink sink = openWrite(mode: mode);
535 sink.add(bytes); 535 sink.add(bytes);
536 sink.close(); 536 sink.close();
537 return sink.done.then((_) => this);; 537 return sink.done.then((_) => this);
538 } catch (e) { 538 } catch (e) {
539 return new Future.error(e); 539 return new Future.error(e);
540 } 540 }
541 } 541 }
542 542
543 void writeAsBytesSync(List<int> bytes, {FileMode mode: FileMode.WRITE}) { 543 void writeAsBytesSync(List<int> bytes, {FileMode mode: FileMode.WRITE}) {
544 RandomAccessFile opened = openSync(mode: mode); 544 RandomAccessFile opened = openSync(mode: mode);
545 opened.writeFromSync(bytes, 0, bytes.length); 545 opened.writeFromSync(bytes, 0, bytes.length);
546 opened.closeSync(); 546 opened.closeSync();
547 } 547 }
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 996
997 Future _closedException() { 997 Future _closedException() {
998 return new Future.error(new FileIOException("File closed '$_path'")); 998 return new Future.error(new FileIOException("File closed '$_path'"));
999 } 999 }
1000 1000
1001 final String _path; 1001 final String _path;
1002 int _id; 1002 int _id;
1003 1003
1004 SendPort _fileService; 1004 SendPort _fileService;
1005 } 1005 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/typechecker.dart ('k') | tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698