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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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
« no previous file with comments | « runtime/bin/buffer_list.dart ('k') | runtime/bin/directory.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 // Constants used when working with native ports. 5 // Constants used when working with native ports.
6 const int _SUCCESS_RESPONSE = 0; 6 const int _SUCCESS_RESPONSE = 0;
7 const int _ILLEGAL_ARGUMENT_RESPONSE = 1; 7 const int _ILLEGAL_ARGUMENT_RESPONSE = 1;
8 const int _OSERROR_RESPONSE = 2; 8 const int _OSERROR_RESPONSE = 2;
9 const int _FILE_CLOSED_RESPONSE = 3; 9 const int _FILE_CLOSED_RESPONSE = 3;
10 10
11 const int _ERROR_RESPONSE_ERROR_TYPE = 0; 11 const int _ERROR_RESPONSE_ERROR_TYPE = 0;
12 const int _OSERROR_RESPONSE_ERROR_CODE = 1; 12 const int _OSERROR_RESPONSE_ERROR_CODE = 1;
13 const int _OSERROR_RESPONSE_MESSAGE = 2; 13 const int _OSERROR_RESPONSE_MESSAGE = 2;
14 14
15 /** 15 /**
16 * An [OSError] object holds information about an error from the 16 * An [OSError] object holds information about an error from the
17 * operating system. 17 * operating system.
18 */ 18 */
19 class OSError { 19 class OSError {
20 /** Constant used to indicate that no OS error code is available. */ 20 /** Constant used to indicate that no OS error code is available. */
21 static const int noErrorCode = -1; 21 static const int noErrorCode = -1;
22 22
23 /** Creates an OSError object from a message and an errorCode. */ 23 /** Creates an OSError object from a message and an errorCode. */
24 const OSError([String this.message = "", int this.errorCode = noErrorCode]); 24 const OSError([String this.message = "", int this.errorCode = noErrorCode]);
25 25
26 /** Converts an OSError object to a string representation. */ 26 /** Converts an OSError object to a string representation. */
27 String toString() { 27 String toString() {
28 StringBuffer sb = new StringBuffer(); 28 StringBuffer sb = new StringBuffer();
29 sb.add("OS Error"); 29 sb.add("OS Error");
30 if (!message.isEmpty()) { 30 if (!message.isEmpty) {
31 sb.add(": "); 31 sb.add(": ");
32 sb.add(message); 32 sb.add(message);
33 if (errorCode != noErrorCode) { 33 if (errorCode != noErrorCode) {
34 sb.add(", errno = "); 34 sb.add(", errno = ");
35 sb.add(errorCode.toString()); 35 sb.add(errorCode.toString());
36 } 36 }
37 } else if (errorCode != noErrorCode) { 37 } else if (errorCode != noErrorCode) {
38 sb.add(": errno = "); 38 sb.add(": errno = ");
39 sb.add(errorCode.toString()); 39 sb.add(errorCode.toString());
40 } 40 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 for (int i = 0; i < bytes; i++) { 83 for (int i = 0; i < bytes; i++) {
84 int value = buffer[j]; 84 int value = buffer[j];
85 if (value is! int) { 85 if (value is! int) {
86 throw new FileIOException("List element is not an integer at index $j"); 86 throw new FileIOException("List element is not an integer at index $j");
87 } 87 }
88 newBuffer[i] = value; 88 newBuffer[i] = value;
89 j++; 89 j++;
90 } 90 }
91 return new _BufferAndOffset(newBuffer, 0); 91 return new _BufferAndOffset(newBuffer, 0);
92 } 92 }
OLDNEW
« no previous file with comments | « runtime/bin/buffer_list.dart ('k') | runtime/bin/directory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698