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

Unified Diff: sdk/lib/io/stdio.dart

Issue 1904553006: Fix strong mode errors in dart:io. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment.~ 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/stdio.dart
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index feea4fffc08249eb5d100e1b81c210fec024f138..8fb196dbaae0e55c63dd85117146077cb63c90dd 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -328,13 +328,19 @@ StdioType stdioType(object) {
return StdioType.FILE;
}
if (object is Socket) {
- switch (_StdIOUtils._socketType(object._nativeSocket)) {
- case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL;
- case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE;
- case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE;
+ int socketType = _StdIOUtils._socketType(object);
+ if (socketType != null) {
Florian Schneider 2016/05/09 09:05:15 Why is this null-check necessary?
floitsch 2016/05/09 12:48:01 Because it returns `null` if the object is not a `
Florian Schneider 2016/05/09 13:39:43 Ok, but in case of null the switch would be skippe
floitsch 2016/05/09 14:21:32 Changed it so that it directly returns StdioType.O
+ switch (socketType) {
+ case _STDIO_HANDLE_TYPE_TERMINAL:
+ return StdioType.TERMINAL;
+ case _STDIO_HANDLE_TYPE_PIPE:
+ return StdioType.PIPE;
+ case _STDIO_HANDLE_TYPE_FILE:
+ return StdioType.FILE;
+ }
}
}
- if (object is IOSink) {
+ if (object is _IOSinkImpl) {
try {
if (object._target is _FileStreamConsumer) {
return StdioType.FILE;
@@ -350,6 +356,6 @@ StdioType stdioType(object) {
class _StdIOUtils {
external static _getStdioOutputStream(int fd);
external static Stdin _getStdioInputStream();
- external static int _socketType(nativeSocket);
+ external static int _socketType(Socket socket);
external static _getStdioHandleType(int fd);
}

Powered by Google App Engine
This is Rietveld 408576698