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 | 5 @patch |
6 class Error { | 6 class Error { |
7 @patch | 7 @patch |
8 static String _objectToString(Object object) { | 8 static String _objectToString(Object object) { |
9 return Object._toString(object); | 9 return Object._toString(object); |
10 } | 10 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 { | 305 { |
306 if (_receiver == null) { | 306 if (_receiver == null) { |
307 if (args_mismatch) { | 307 if (args_mismatch) { |
308 msg_buf.writeln("The null object does not have a $type_str " | 308 msg_buf.writeln("The null object does not have a $type_str " |
309 "'$memberName'$args_message."); | 309 "'$memberName'$args_message."); |
310 } else { | 310 } else { |
311 msg_buf | 311 msg_buf |
312 .writeln("The $type_str '$memberName' was called on null."); | 312 .writeln("The $type_str '$memberName' was called on null."); |
313 } | 313 } |
314 } else { | 314 } else { |
315 if (_receiver is Function) { | 315 if (_receiver is _Closure) { |
316 msg_buf.writeln("Closure call with mismatched arguments: " | 316 msg_buf.writeln("Closure call with mismatched arguments: " |
317 "function '$memberName'"); | 317 "function '$memberName'"); |
318 } else if (_receiver is _Type && memberName == "call") { | 318 } else if (_receiver is _Type && memberName == "call") { |
319 is_type_call = true; | 319 is_type_call = true; |
320 String name = _receiver.toString(); | 320 String name = _receiver.toString(); |
321 msg_buf.writeln("Attempted to use type '$name' as a function. " | 321 msg_buf.writeln("Attempted to use type '$name' as a function. " |
322 "Since types do not define a method 'call', this is not " | 322 "Since types do not define a method 'call', this is not " |
323 "possible. Did you intend to call the $name constructor and " | 323 "possible. Did you intend to call the $name constructor and " |
324 "forget the 'new' operator?"); | 324 "forget the 'new' operator?"); |
325 } else { | 325 } else { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 return msg_buf.toString(); | 389 return msg_buf.toString(); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 class _CompileTimeError extends Error { | 393 class _CompileTimeError extends Error { |
394 final String _errorMsg; | 394 final String _errorMsg; |
395 _CompileTimeError(this._errorMsg); | 395 _CompileTimeError(this._errorMsg); |
396 String toString() => _errorMsg; | 396 String toString() => _errorMsg; |
397 } | 397 } |
OLD | NEW |