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 import 'dart:_internal' as internal; | 5 import 'dart:_internal' as internal; |
6 import 'dart:convert' show JSON; | 6 import 'dart:convert' show JSON; |
7 | 7 |
8 @patch class Error { | 8 @patch class Error { |
9 @patch static String _objectToString(Object object) { | 9 @patch static String _objectToString(Object object) { |
10 return Object._toString(object); | 10 return Object._toString(object); |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 static void _checkAssertion(condition, int start, int end) { | 29 static void _checkAssertion(condition, int start, int end) { |
30 if (condition is Function) { | 30 if (condition is Function) { |
31 condition = condition(); | 31 condition = condition(); |
32 } | 32 } |
33 if (!condition) { | 33 if (!condition) { |
34 _throwNew(start, end); | 34 _throwNew(start, end); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
| 38 static void _checkConstAssertion(bool condition, int start, int end) { |
| 39 if (!condition) { |
| 40 _throwNew(start, end); |
| 41 } |
| 42 } |
| 43 |
38 String toString() { | 44 String toString() { |
39 if (_url == null) { | 45 if (_url == null) { |
40 return _failedAssertion; | 46 return _failedAssertion; |
41 } | 47 } |
42 var columnInfo = ""; | 48 var columnInfo = ""; |
43 if (_column > 0) { | 49 if (_column > 0) { |
44 // Only add column information if it is valid. | 50 // Only add column information if it is valid. |
45 columnInfo = " pos $_column"; | 51 columnInfo = " pos $_column"; |
46 } | 52 } |
47 return "'$_url': Failed assertion: line $_line$columnInfo: " | 53 return "'$_url': Failed assertion: line $_line$columnInfo: " |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 msg_buf.write( | 351 msg_buf.write( |
346 "NoSuchMethodError: incorrect number of arguments passed to " | 352 "NoSuchMethodError: incorrect number of arguments passed to " |
347 "method named '$memberName'\n" | 353 "method named '$memberName'\n" |
348 "Receiver: $receiver_str\n" | 354 "Receiver: $receiver_str\n" |
349 "Tried calling: $memberName($actualParameters)\n" | 355 "Tried calling: $memberName($actualParameters)\n" |
350 "Found: $memberName($formalParameters)"); | 356 "Found: $memberName($formalParameters)"); |
351 } | 357 } |
352 return msg_buf.toString(); | 358 return msg_buf.toString(); |
353 } | 359 } |
354 } | 360 } |
OLD | NEW |