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

Side by Side Diff: runtime/bin/stdio_patch.dart

Issue 1904553006: Fix strong mode errors in dart:io. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Few fixes Created 4 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
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 patch class _StdIOUtils { 5 patch class _StdIOUtils {
6 static Stdin _getStdioInputStream() { 6 static Stdin _getStdioInputStream() {
7 switch (_getStdioHandleType(0)) { 7 switch (_getStdioHandleType(0)) {
8 case _STDIO_HANDLE_TYPE_TERMINAL: 8 case _STDIO_HANDLE_TYPE_TERMINAL:
9 case _STDIO_HANDLE_TYPE_PIPE: 9 case _STDIO_HANDLE_TYPE_PIPE:
10 case _STDIO_HANDLE_TYPE_SOCKET: 10 case _STDIO_HANDLE_TYPE_SOCKET:
(...skipping 11 matching lines...) Expand all
22 case _STDIO_HANDLE_TYPE_TERMINAL: 22 case _STDIO_HANDLE_TYPE_TERMINAL:
23 case _STDIO_HANDLE_TYPE_PIPE: 23 case _STDIO_HANDLE_TYPE_PIPE:
24 case _STDIO_HANDLE_TYPE_SOCKET: 24 case _STDIO_HANDLE_TYPE_SOCKET:
25 case _STDIO_HANDLE_TYPE_FILE: 25 case _STDIO_HANDLE_TYPE_FILE:
26 return new Stdout._(new IOSink(new _StdConsumer(fd)), fd); 26 return new Stdout._(new IOSink(new _StdConsumer(fd)), fd);
27 default: 27 default:
28 throw new FileSystemException("Unsupported stdin type"); 28 throw new FileSystemException("Unsupported stdin type");
29 } 29 }
30 } 30 }
31 31
32 static int _socketType(nativeSocket) { 32 static int _socketType(Socket socket) {
33 if (socket is _Socket) return _nativeSocketType(socket._nativeSocket);
34 return null;
35 }
36
37 static int _nativeSocketType(_NativeSocket nativeSocket) {
33 var result = _getSocketType(nativeSocket); 38 var result = _getSocketType(nativeSocket);
34 if (result is OSError) { 39 if (result is OSError) {
35 throw new FileSystemException("Error retrieving socket type", "", result); 40 throw new FileSystemException(
41 "Error retrieving socket type", "", result);
36 } 42 }
37 return result; 43 return result;
38 } 44 }
39 45
40 static _getStdioHandleType(int fd) native "File_GetStdioHandleType"; 46 static _getStdioHandleType(int fd) native "File_GetStdioHandleType";
41 } 47 }
42 48
43 patch class Stdin { 49 patch class Stdin {
44 /* patch */ int readByteSync() native "Stdin_ReadByte"; 50 /* patch */ int readByteSync() native "Stdin_ReadByte";
45 51
(...skipping 29 matching lines...) Expand all
75 } 81 }
76 return size; 82 return size;
77 } 83 }
78 84
79 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; 85 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize";
80 } 86 }
81 87
82 88
83 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; 89 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle";
84 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; 90 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType";
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698