OLD | NEW |
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 // Patch file for dart:core classes. | 5 // Patch file for dart:core classes. |
6 | 6 |
7 import 'dart:_interceptors'; | 7 import 'dart:_interceptors'; |
8 import 'dart:_js_helper' show checkNull, | 8 import 'dart:_js_helper' show checkNull, |
9 getRuntimeTypeString, | 9 getRuntimeTypeString, |
10 isJsArray, | 10 isJsArray, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 patch String toString() => _contents; | 241 patch String toString() => _contents; |
242 } | 242 } |
243 | 243 |
244 patch class NoSuchMethodError { | 244 patch class NoSuchMethodError { |
245 patch String toString() { | 245 patch String toString() { |
246 StringBuffer sb = new StringBuffer(); | 246 StringBuffer sb = new StringBuffer(); |
247 int i = 0; | 247 int i = 0; |
248 if (_arguments != null) { | 248 if (_arguments != null) { |
249 for (; i < _arguments.length; i++) { | 249 for (; i < _arguments.length; i++) { |
250 if (i > 0) { | 250 if (i > 0) { |
251 sb.add(", "); | 251 sb.write(", "); |
252 } | 252 } |
253 sb.add(Error.safeToString(_arguments[i])); | 253 sb.write(Error.safeToString(_arguments[i])); |
254 } | 254 } |
255 } | 255 } |
256 if (_namedArguments != null) { | 256 if (_namedArguments != null) { |
257 _namedArguments.forEach((String key, var value) { | 257 _namedArguments.forEach((String key, var value) { |
258 if (i > 0) { | 258 if (i > 0) { |
259 sb.add(", "); | 259 sb.write(", "); |
260 } | 260 } |
261 sb.add(key); | 261 sb.write(key); |
262 sb.add(": "); | 262 sb.write(": "); |
263 sb.add(Error.safeToString(value)); | 263 sb.write(Error.safeToString(value)); |
264 i++; | 264 i++; |
265 }); | 265 }); |
266 } | 266 } |
267 if (_existingArgumentNames == null) { | 267 if (_existingArgumentNames == null) { |
268 return "NoSuchMethodError : method not found: '$_memberName'\n" | 268 return "NoSuchMethodError : method not found: '$_memberName'\n" |
269 "Receiver: ${Error.safeToString(_receiver)}\n" | 269 "Receiver: ${Error.safeToString(_receiver)}\n" |
270 "Arguments: [$sb]"; | 270 "Arguments: [$sb]"; |
271 } else { | 271 } else { |
272 String actualParameters = sb.toString(); | 272 String actualParameters = sb.toString(); |
273 sb = new StringBuffer(); | 273 sb = new StringBuffer(); |
274 for (int i = 0; i < _existingArgumentNames.length; i++) { | 274 for (int i = 0; i < _existingArgumentNames.length; i++) { |
275 if (i > 0) { | 275 if (i > 0) { |
276 sb.add(", "); | 276 sb.write(", "); |
277 } | 277 } |
278 sb.add(_existingArgumentNames[i]); | 278 sb.write(_existingArgumentNames[i]); |
279 } | 279 } |
280 String formalParameters = sb.toString(); | 280 String formalParameters = sb.toString(); |
281 return "NoSuchMethodError: incorrect number of arguments passed to " | 281 return "NoSuchMethodError: incorrect number of arguments passed to " |
282 "method named '$_memberName'\n" | 282 "method named '$_memberName'\n" |
283 "Receiver: ${Error.safeToString(_receiver)}\n" | 283 "Receiver: ${Error.safeToString(_receiver)}\n" |
284 "Tried calling: $_memberName($actualParameters)\n" | 284 "Tried calling: $_memberName($actualParameters)\n" |
285 "Found: $_memberName($formalParameters)"; | 285 "Found: $_memberName($formalParameters)"; |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 patch class StackTrace { | 290 patch class StackTrace { |
291 patch String get fullStackTrace { | 291 patch String get fullStackTrace { |
292 throw new UnsupportedError('fullStackTrace'); | 292 throw new UnsupportedError('fullStackTrace'); |
293 } | 293 } |
294 | 294 |
295 patch String get stackTrace { | 295 patch String get stackTrace { |
296 throw new UnsupportedError('stackTrace'); | 296 throw new UnsupportedError('stackTrace'); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
OLD | NEW |