| 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 class Error { | 5 class Error { |
| 6 const Error(); | 6 const Error(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 class AssertionError implements Error { | 9 class AssertionError implements Error { |
| 10 } | 10 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 List this._arguments, | 50 List this._arguments, |
| 51 [List existingArgumentNames = null]) | 51 [List existingArgumentNames = null]) |
| 52 : this._existingArgumentNames = existingArgumentNames; | 52 : this._existingArgumentNames = existingArgumentNames; |
| 53 | 53 |
| 54 String toString() { | 54 String toString() { |
| 55 StringBuffer sb = new StringBuffer(); | 55 StringBuffer sb = new StringBuffer(); |
| 56 for (int i = 0; i < _arguments.length; i++) { | 56 for (int i = 0; i < _arguments.length; i++) { |
| 57 if (i > 0) { | 57 if (i > 0) { |
| 58 sb.add(", "); | 58 sb.add(", "); |
| 59 } | 59 } |
| 60 sb.add(_arguments[i]); | 60 sb.add(safeToString(_arguments[i])); |
| 61 } | 61 } |
| 62 if (_existingArgumentNames === null) { | 62 if (_existingArgumentNames === null) { |
| 63 return "NoSuchMethodError : method not found: '$_functionName'\n" | 63 return "NoSuchMethodError : method not found: '$_functionName'\n" |
| 64 "Receiver: $_receiver\n" | 64 "Receiver: ${safeToString(_receiver)}\n" |
| 65 "Arguments: [$sb]"; | 65 "Arguments: [$sb]"; |
| 66 } else { | 66 } else { |
| 67 String actualParameters = sb.toString(); | 67 String actualParameters = sb.toString(); |
| 68 sb = new StringBuffer(); | 68 sb = new StringBuffer(); |
| 69 for (int i = 0; i < _existingArgumentNames.length; i++) { | 69 for (int i = 0; i < _existingArgumentNames.length; i++) { |
| 70 if (i > 0) { | 70 if (i > 0) { |
| 71 sb.add(", "); | 71 sb.add(", "); |
| 72 } | 72 } |
| 73 sb.add(_existingArgumentNames[i]); | 73 sb.add(_existingArgumentNames[i]); |
| 74 } | 74 } |
| 75 String formalParameters = sb.toString(); | 75 String formalParameters = sb.toString(); |
| 76 return "NoSuchMethodError: incorrect number of arguments passed to " | 76 return "NoSuchMethodError: incorrect number of arguments passed to " |
| 77 "method named '$_functionName'\nReceiver: $_receiver\n" | 77 "method named '$_functionName'\n" |
| 78 "Receiver: ${safeToString(_receiver)}\n" |
| 78 "Tried calling: $_functionName($actualParameters)\n" | 79 "Tried calling: $_functionName($actualParameters)\n" |
| 79 "Found: $_functionName($formalParameters)"; | 80 "Found: $_functionName($formalParameters)"; |
| 80 } | 81 } |
| 81 } | 82 } |
| 83 |
| 84 external static String safeToString(Object object); |
| 82 } | 85 } |
| OLD | NEW |