Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.generated.java_core; | 5 library analyzer.src.generated.java_core; |
| 6 | 6 |
| 7 final Stopwatch nanoTimeStopwatch = new Stopwatch(); | 7 final Stopwatch nanoTimeStopwatch = new Stopwatch(); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Inserts the given arguments into [pattern]. | 10 * Inserts the given arguments into [pattern]. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 if (c == 0x64) { | 79 if (c == 0x64) { |
| 80 sb.write(args[argIndex++]); | 80 sb.write(args[argIndex++]); |
| 81 continue; | 81 continue; |
| 82 } | 82 } |
| 83 // %s | 83 // %s |
| 84 if (c == 0x73) { | 84 if (c == 0x73) { |
| 85 sb.write(args[argIndex++]); | 85 sb.write(args[argIndex++]); |
| 86 continue; | 86 continue; |
| 87 } | 87 } |
| 88 // unknown | 88 // unknown |
| 89 throw new IllegalArgumentException( | 89 throw new ArgumentError('[$fmt][$i] = 0x${c.toRadixString(16)}'); |
| 90 '[$fmt][$i] = 0x${c.toRadixString(16)}'); | |
| 91 } else { | 90 } else { |
| 92 sb.writeCharCode(c); | 91 sb.writeCharCode(c); |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 return sb.toString(); | 94 return sb.toString(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 class Character { | 97 class Character { |
| 99 static const int MAX_VALUE = 0xffff; | 98 static const int MAX_VALUE = 0xffff; |
| 100 static const int MAX_CODE_POINT = 0x10ffff; | 99 static const int MAX_CODE_POINT = 0x10ffff; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 123 static bool isLetter(int c) => | 122 static bool isLetter(int c) => |
| 124 c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A; | 123 c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A; |
| 125 | 124 |
| 126 static bool isLetterOrDigit(int c) => isLetter(c) || isDigit(c); | 125 static bool isLetterOrDigit(int c) => isLetter(c) || isDigit(c); |
| 127 | 126 |
| 128 static bool isWhitespace(int c) => | 127 static bool isWhitespace(int c) => |
| 129 c == 0x09 || c == 0x20 || c == 0x0A || c == 0x0D; | 128 c == 0x09 || c == 0x20 || c == 0x0A || c == 0x0D; |
| 130 | 129 |
| 131 static String toChars(int codePoint) { | 130 static String toChars(int codePoint) { |
| 132 if (codePoint < 0 || codePoint > MAX_CODE_POINT) { | 131 if (codePoint < 0 || codePoint > MAX_CODE_POINT) { |
| 133 throw new IllegalArgumentException(); | 132 throw new ArgumentError(); |
| 134 } | 133 } |
| 135 if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) { | 134 if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) { |
| 136 return new String.fromCharCode(codePoint); | 135 return new String.fromCharCode(codePoint); |
| 137 } | 136 } |
| 138 int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT; | 137 int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT; |
| 139 int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE; | 138 int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE; |
| 140 int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE; | 139 int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE; |
| 141 return new String.fromCharCodes([c0, c1]); | 140 return new String.fromCharCodes([c0, c1]); |
| 142 } | 141 } |
| 143 } | 142 } |
| 144 | 143 |
| 145 abstract class Enum<E extends Enum> implements Comparable<E> { | 144 abstract class Enum<E extends Enum> implements Comparable<E> { |
| 146 /// The name of this enum constant, as declared in the enum declaration. | 145 /// The name of this enum constant, as declared in the enum declaration. |
| 147 final String name; | 146 final String name; |
| 148 | 147 |
| 149 /// The position in the enum declaration. | 148 /// The position in the enum declaration. |
| 150 final int ordinal; | 149 final int ordinal; |
| 151 const Enum(this.name, this.ordinal); | 150 const Enum(this.name, this.ordinal); |
| 152 int get hashCode => ordinal; | 151 int get hashCode => ordinal; |
| 153 int compareTo(E other) => ordinal - other.ordinal; | 152 int compareTo(E other) => ordinal - other.ordinal; |
| 154 String toString() => name; | 153 String toString() => name; |
| 155 } | 154 } |
| 156 | 155 |
| 157 class IllegalArgumentException extends JavaException { | |
|
Brian Wilkerson
2016/09/08 22:38:57
Should we deprecate these instead of deleting them
scheglov
2016/09/08 22:48:13
Fortunately almost nobody uses these removed class
| |
| 158 IllegalArgumentException([message = "", cause = null]) | |
| 159 : super(message, cause); | |
| 160 } | |
| 161 | |
| 162 class IllegalStateException extends JavaException { | |
| 163 IllegalStateException([message = ""]) : super(message); | |
| 164 } | |
| 165 | |
| 166 class JavaArrays { | 156 class JavaArrays { |
| 167 static int makeHashCode(List a) { | 157 static int makeHashCode(List a) { |
| 168 // TODO(rnystrom): This is not used by analyzer, but is called by | 158 // TODO(rnystrom): This is not used by analyzer, but is called by |
| 169 // analysis_server. Move this code there and remove it from here. | 159 // analysis_server. Move this code there and remove it from here. |
| 170 if (a == null) { | 160 if (a == null) { |
| 171 return 0; | 161 return 0; |
| 172 } | 162 } |
| 173 int result = 1; | 163 int result = 1; |
| 174 for (var element in a) { | 164 for (var element in a) { |
| 175 result = 31 * result + (element == null ? 0 : element.hashCode); | 165 result = 31 * result + (element == null ? 0 : element.hashCode); |
| 176 } | 166 } |
| 177 return result; | 167 return result; |
| 178 } | 168 } |
| 179 } | 169 } |
| 180 | 170 |
| 181 class JavaException implements Exception { | |
| 182 final String message; | |
| 183 final Object cause; | |
| 184 JavaException([this.message = "", this.cause = null]); | |
| 185 JavaException.withCause(this.cause) : message = null; | |
| 186 String toString() => "$runtimeType: $message $cause"; | |
| 187 } | |
| 188 | |
| 189 class JavaIOException extends JavaException { | |
| 190 JavaIOException([message = "", cause = null]) : super(message, cause); | |
| 191 } | |
| 192 | |
| 193 class JavaPatternMatcher { | 171 class JavaPatternMatcher { |
| 194 Iterator<Match> _matches; | 172 Iterator<Match> _matches; |
| 195 Match _match; | 173 Match _match; |
| 196 JavaPatternMatcher(RegExp re, String input) { | 174 JavaPatternMatcher(RegExp re, String input) { |
| 197 _matches = re.allMatches(input).iterator; | 175 _matches = re.allMatches(input).iterator; |
| 198 } | 176 } |
| 199 int end() => _match.end; | 177 int end() => _match.end; |
| 200 bool find() { | 178 bool find() { |
| 201 if (!_matches.moveNext()) { | 179 if (!_matches.moveNext()) { |
| 202 return false; | 180 return false; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 230 } | 208 } |
| 231 | 209 |
| 232 static int nanoTime() { | 210 static int nanoTime() { |
| 233 if (!nanoTimeStopwatch.isRunning) { | 211 if (!nanoTimeStopwatch.isRunning) { |
| 234 nanoTimeStopwatch.start(); | 212 nanoTimeStopwatch.start(); |
| 235 } | 213 } |
| 236 return nanoTimeStopwatch.elapsedMicroseconds * 1000; | 214 return nanoTimeStopwatch.elapsedMicroseconds * 1000; |
| 237 } | 215 } |
| 238 } | 216 } |
| 239 | 217 |
| 240 class MissingFormatArgumentException implements Exception { | |
| 241 final String s; | |
| 242 | |
| 243 MissingFormatArgumentException(this.s); | |
| 244 | |
| 245 String toString() => "MissingFormatArgumentException: $s"; | |
| 246 } | |
| 247 | |
| 248 class NoSuchElementException extends JavaException { | |
| 249 String toString() => "NoSuchElementException"; | |
| 250 } | |
| 251 | |
| 252 class NotImplementedException extends JavaException { | |
| 253 NotImplementedException(message) : super(message); | |
| 254 } | |
| 255 | |
| 256 class NumberFormatException extends JavaException { | |
| 257 String toString() => "NumberFormatException"; | |
| 258 } | |
| 259 | |
| 260 class PrintStringWriter extends PrintWriter { | 218 class PrintStringWriter extends PrintWriter { |
| 261 final StringBuffer _sb = new StringBuffer(); | 219 final StringBuffer _sb = new StringBuffer(); |
| 262 | 220 |
| 263 void print(x) { | 221 void print(x) { |
| 264 _sb.write(x); | 222 _sb.write(x); |
| 265 } | 223 } |
| 266 | 224 |
| 267 String toString() => _sb.toString(); | 225 String toString() => _sb.toString(); |
| 268 } | 226 } |
| 269 | 227 |
| 270 abstract class PrintWriter { | 228 abstract class PrintWriter { |
| 271 void newLine() { | 229 void newLine() { |
| 272 this.print('\n'); | 230 this.print('\n'); |
| 273 } | 231 } |
| 274 | 232 |
| 275 void print(x); | 233 void print(x); |
| 276 | 234 |
| 277 void printf(String fmt, List args) { | 235 void printf(String fmt, List args) { |
| 278 this.print(_printf(fmt, args)); | 236 this.print(_printf(fmt, args)); |
| 279 } | 237 } |
| 280 | 238 |
| 281 void println(String s) { | 239 void println(String s) { |
| 282 this.print(s); | 240 this.print(s); |
| 283 this.newLine(); | 241 this.newLine(); |
| 284 } | 242 } |
| 285 } | 243 } |
| 286 | 244 |
| 287 class RuntimeException extends JavaException { | |
| 288 RuntimeException({String message: "", Exception cause: null}) | |
| 289 : super(message, cause); | |
| 290 } | |
| 291 | |
| 292 class StringIndexOutOfBoundsException extends JavaException { | |
| 293 StringIndexOutOfBoundsException(int index) : super('$index'); | |
| 294 } | |
| 295 | |
| 296 class UnsupportedOperationException extends JavaException { | |
| 297 UnsupportedOperationException([message = ""]) : super(message); | |
| 298 } | |
| 299 | |
| 300 class URISyntaxException implements Exception { | 245 class URISyntaxException implements Exception { |
| 301 final String message; | 246 final String message; |
| 302 URISyntaxException(this.message); | 247 URISyntaxException(this.message); |
| 303 String toString() => "URISyntaxException: $message"; | 248 String toString() => "URISyntaxException: $message"; |
| 304 } | 249 } |
| OLD | NEW |