| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 // This is a copy of the VM's dart:io library. This API is not usable | |
| 6 // when running inside a web browser. Nevertheless, Leg provides a | |
| 7 // mock version of the dart:io library so that it can statically | |
| 8 // analyze programs that use dart:io. | |
| 9 | |
| 10 // TODO(ahe): Separate API from implementation details. | |
| 11 | |
| 12 #library("io"); | |
| 13 #import("dart:coreimpl"); | |
| 14 #import("dart:isolate"); | |
| 15 // TODO(ahe): Should Leg support this library? | |
| 16 // #import("dart:nativewrappers"); | |
| 17 #import("dart:uri"); | |
| 18 #source('../../../runtime/bin/buffer_list.dart'); | |
| 19 #source('../../../runtime/bin/common.dart'); | |
| 20 #source('../../../runtime/bin/chunked_stream.dart'); | |
| 21 #source('../../../runtime/bin/directory.dart'); | |
| 22 // Uses native keyword. | |
| 23 // #source('../../../runtime/bin/directory_impl.dart'); | |
| 24 // Uses native keyword. | |
| 25 // #source('../../../runtime/bin/eventhandler.dart'); | |
| 26 #source('../../../runtime/bin/file.dart'); | |
| 27 // Uses native keyword. | |
| 28 // #source('../../../runtime/bin/file_impl.dart'); | |
| 29 #source('../../../runtime/bin/http.dart'); | |
| 30 #source('../../../runtime/bin/http_impl.dart'); | |
| 31 #source('../../../runtime/bin/http_parser.dart'); | |
| 32 #source('../../../runtime/bin/http_utils.dart'); | |
| 33 #source('../../../runtime/bin/input_stream.dart'); | |
| 34 #source('../../../runtime/bin/list_stream.dart'); | |
| 35 #source('../../../runtime/bin/list_stream_impl.dart'); | |
| 36 #source('../../../runtime/bin/output_stream.dart'); | |
| 37 #source('../../../runtime/bin/stream_util.dart'); | |
| 38 #source('../../../runtime/bin/string_stream.dart'); | |
| 39 #source('../../../runtime/bin/platform.dart'); | |
| 40 // Uses native keyword. | |
| 41 // #source('../../../runtime/bin/platform_impl.dart'); | |
| 42 #source('../../../runtime/bin/process.dart'); | |
| 43 // Uses native keyword. | |
| 44 // #source('../../../runtime/bin/process_impl.dart'); | |
| 45 #source('../../../runtime/bin/socket.dart'); | |
| 46 // Uses native keyword. | |
| 47 // #source('../../../runtime/bin/socket_impl.dart'); | |
| 48 #source('../../../runtime/bin/socket_stream.dart'); | |
| 49 #source('../../../runtime/bin/socket_stream_impl.dart'); | |
| 50 // Uses native keyword. | |
| 51 // #source('../../../runtime/bin/stdio.dart'); | |
| 52 #source('../../../runtime/bin/timer.dart'); | |
| 53 #source('../../../runtime/bin/timer_impl.dart'); | |
| 54 | |
| 55 class _File implements File { | |
| 56 factory File(arg) { | |
| 57 throw new UnsupportedOperationException('new File($arg)'); | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 class _Platform implements Platform { | |
| 62 factory Platform() { | |
| 63 throw new UnsupportedOperationException('new Platform()'); | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 class _Directory implements Directory { | |
| 68 factory Directory(arg) { | |
| 69 throw new UnsupportedOperationException('new Directory($arg)'); | |
| 70 } | |
| 71 | |
| 72 factory Directory.current() { | |
| 73 throw new UnsupportedOperationException('new Directory.current()'); | |
| 74 } | |
| 75 } | |
| 76 | |
| 77 class _Process implements Process { | |
| 78 factory Process.start(String executable, | |
| 79 List<String> arguments, | |
| 80 [String workingDirectory]) { | |
| 81 var msg = 'new Process.start($executable, $arguments, $workingDirectory'; | |
| 82 throw new UnsupportedOperationException(msg); | |
| 83 } | |
| 84 } | |
| 85 | |
| 86 class _ServerSocket implements ServerSocket { | |
| 87 factory _ServerSocket(String bindAddress, int port, int backlog) { | |
| 88 throw new UnsupportedOperationException( | |
| 89 'new ServerSocket($bindAddress, $port, $backlog)'); | |
| 90 } | |
| 91 } | |
| 92 | |
| 93 class _Socket implements Socket { | |
| 94 factory Socket(String host, int port) { | |
| 95 throw new UnsupportedOperationException('new Socket($host, $port)'); | |
| 96 } | |
| 97 } | |
| 98 | |
| 99 class _EventHandler { | |
| 100 factory _EventHandler() { | |
| 101 throw new UnsupportedOperationException('new _EventHandler()'); | |
| 102 } | |
| 103 | |
| 104 static void _start() { | |
| 105 throw new UnsupportedOperationException('_EventHandler._start()'); | |
| 106 } | |
| 107 | |
| 108 static _sendData(int id, ReceivePort receivePort, int data) { | |
| 109 var msg = '_EventHandler._sendData($id, $receivePort, $data)'; | |
| 110 throw new UnsupportedOperationException(msg); | |
| 111 } | |
| 112 | |
| 113 static _EventHandler get _eventHandler() { | |
| 114 throw new UnsupportedOperationException('_EventHandler._eventhandler'); | |
| 115 } | |
| 116 | |
| 117 static void set _eventHandler(_EventHandler e) { | |
| 118 throw new UnsupportedOperationException('_EventHandler._eventhandler = $e'); | |
| 119 } | |
| 120 } | |
| 121 | |
| 122 final InputStream stdin = null; | |
| 123 | |
| 124 final OutputStream stdout = null; | |
| 125 | |
| 126 final OutputStream stderr = null; | |
| OLD | NEW |