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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/io.dart

Issue 2718113003: Run dartfmt on pkg/front_end/lib. (Closed)
Patch Set: Rerun after merging. Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library fasta.scanner.io; 5 library fasta.scanner.io;
6 6
7 import 'dart:async' show 7 import 'dart:async' show Future;
8 Future;
9 8
10 import 'dart:io' show 9 import 'dart:io' show File, RandomAccessFile;
11 File,
12 RandomAccessFile;
13 10
14 import 'dart:typed_data' show 11 import 'dart:typed_data' show Uint8List;
15 Uint8List;
16 12
17 List<int> readBytesFromFileSync(Uri uri) { 13 List<int> readBytesFromFileSync(Uri uri) {
18 RandomAccessFile file = new File.fromUri(uri).openSync(); 14 RandomAccessFile file = new File.fromUri(uri).openSync();
19 Uint8List list; 15 Uint8List list;
20 try { 16 try {
21 int length = file.lengthSync(); 17 int length = file.lengthSync();
22 // +1 to have a 0 terminated list, see [Scanner]. 18 // +1 to have a 0 terminated list, see [Scanner].
23 list = new Uint8List(length + 1); 19 list = new Uint8List(length + 1);
24 file.readIntoSync(list, 0, length); 20 file.readIntoSync(list, 0, length);
25 } finally { 21 } finally {
(...skipping 11 matching lines...) Expand all
37 list = new Uint8List(length + 1); 33 list = new Uint8List(length + 1);
38 int read = await file.readInto(list); 34 int read = await file.readInto(list);
39 if (read != length) { 35 if (read != length) {
40 throw "Error reading file: ${uri}"; 36 throw "Error reading file: ${uri}";
41 } 37 }
42 } finally { 38 } finally {
43 await file.close(); 39 await file.close();
44 } 40 }
45 return list; 41 return list;
46 } 42 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/error_token.dart ('k') | pkg/front_end/lib/src/fasta/scanner/keyword.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698