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 class Error { | 5 patch class Error { |
6 /* patch */ static String _objectToString(Object object) { | 6 /* patch */ static String _objectToString(Object object) { |
7 return Object._toString(object); | 7 return Object._toString(object); |
8 } | 8 } |
9 | 9 |
10 /* patch */ StackTrace get stackTrace => _stackTrace; | 10 /* patch */ StackTrace get stackTrace => _stackTrace; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 return ""; | 209 return ""; |
210 } | 210 } |
211 var type = _invocation_type & _InvocationMirror._TYPE_MASK; | 211 var type = _invocation_type & _InvocationMirror._TYPE_MASK; |
212 var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & | 212 var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & |
213 _InvocationMirror._CALL_MASK; | 213 _InvocationMirror._CALL_MASK; |
214 var type_str = | 214 var type_str = |
215 (const ["method", "getter", "setter", "getter or setter"])[type]; | 215 (const ["method", "getter", "setter", "getter or setter"])[type]; |
216 var args_message = args_mismatch ? " with matching arguments" : ""; | 216 var args_message = args_mismatch ? " with matching arguments" : ""; |
217 var msg; | 217 var msg; |
218 var memberName = | 218 var memberName = |
219 (_memberName == null) ? "" :_collection_dev.Symbol.getName(_memberName); | 219 (_memberName == null) ? "" : internal.Symbol.getName(_memberName); |
220 switch (level) { | 220 switch (level) { |
221 case _InvocationMirror._DYNAMIC: { | 221 case _InvocationMirror._DYNAMIC: { |
222 if (_receiver == null) { | 222 if (_receiver == null) { |
223 msg = "The null object does not have a $type_str '$memberName'" | 223 msg = "The null object does not have a $type_str '$memberName'" |
224 "$args_message."; | 224 "$args_message."; |
225 } else { | 225 } else { |
226 if (_receiver is Function) { | 226 if (_receiver is Function) { |
227 msg = "Closure call with mismatched arguments: " | 227 msg = "Closure call with mismatched arguments: " |
228 "function '$memberName'"; | 228 "function '$memberName'"; |
229 } else { | 229 } else { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 actual_buf.write(", "); | 269 actual_buf.write(", "); |
270 } | 270 } |
271 actual_buf.write(Error.safeToString(_arguments[i])); | 271 actual_buf.write(Error.safeToString(_arguments[i])); |
272 } | 272 } |
273 } | 273 } |
274 if (_namedArguments != null) { | 274 if (_namedArguments != null) { |
275 _namedArguments.forEach((Symbol key, var value) { | 275 _namedArguments.forEach((Symbol key, var value) { |
276 if (i > 0) { | 276 if (i > 0) { |
277 actual_buf.write(", "); | 277 actual_buf.write(", "); |
278 } | 278 } |
279 actual_buf.write(_collection_dev.Symbol.getName(key)); | 279 actual_buf.write(internal.Symbol.getName(key)); |
280 actual_buf.write(": "); | 280 actual_buf.write(": "); |
281 actual_buf.write(Error.safeToString(value)); | 281 actual_buf.write(Error.safeToString(value)); |
282 i++; | 282 i++; |
283 }); | 283 }); |
284 } | 284 } |
285 var args_mismatch = _existingArgumentNames != null; | 285 var args_mismatch = _existingArgumentNames != null; |
286 StringBuffer msg_buf = new StringBuffer(_developerMessage(args_mismatch)); | 286 StringBuffer msg_buf = new StringBuffer(_developerMessage(args_mismatch)); |
287 String receiver_str; | 287 String receiver_str; |
288 var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & | 288 var level = (_invocation_type >> _InvocationMirror._CALL_SHIFT) & |
289 _InvocationMirror._CALL_MASK; | 289 _InvocationMirror._CALL_MASK; |
290 if ( level == _InvocationMirror._TOP_LEVEL) { | 290 if ( level == _InvocationMirror._TOP_LEVEL) { |
291 receiver_str = "top-level"; | 291 receiver_str = "top-level"; |
292 } else { | 292 } else { |
293 receiver_str = Error.safeToString(_receiver); | 293 receiver_str = Error.safeToString(_receiver); |
294 } | 294 } |
295 var memberName = | 295 var memberName = |
296 (_memberName == null) ? "" :_collection_dev.Symbol.getName(_memberName); | 296 (_memberName == null) ? "" : internal.Symbol.getName(_memberName); |
297 if (!args_mismatch) { | 297 if (!args_mismatch) { |
298 msg_buf.write( | 298 msg_buf.write( |
299 "NoSuchMethodError : method not found: '$memberName'\n" | 299 "NoSuchMethodError : method not found: '$memberName'\n" |
300 "Receiver: $receiver_str\n" | 300 "Receiver: $receiver_str\n" |
301 "Arguments: [$actual_buf]"); | 301 "Arguments: [$actual_buf]"); |
302 } else { | 302 } else { |
303 String actualParameters = actual_buf.toString(); | 303 String actualParameters = actual_buf.toString(); |
304 StringBuffer formal_buf = new StringBuffer(); | 304 StringBuffer formal_buf = new StringBuffer(); |
305 for (int i = 0; i < _existingArgumentNames.length; i++) { | 305 for (int i = 0; i < _existingArgumentNames.length; i++) { |
306 if (i > 0) { | 306 if (i > 0) { |
(...skipping 12 matching lines...) Expand all Loading... |
319 return msg_buf.toString(); | 319 return msg_buf.toString(); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 class _JavascriptIntegerOverflowError extends Error { | 323 class _JavascriptIntegerOverflowError extends Error { |
324 final Object _value; | 324 final Object _value; |
325 | 325 |
326 _JavascriptIntegerOverflowError(this._value); | 326 _JavascriptIntegerOverflowError(this._value); |
327 String toString() => "Javascript Integer Overflow: $_value"; | 327 String toString() => "Javascript Integer Overflow: $_value"; |
328 } | 328 } |
OLD | NEW |