Chromium Code Reviews| 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); |
| 11 } | 11 } |
| 12 | 12 |
| 13 /* patch */ static String _stringToSafeString(String string) { | 13 /* patch */ static String _stringToSafeString(String string) { |
| 14 return JSON.encode(string); | 14 return JSON.encode(string); |
| 15 } | 15 } |
| 16 | 16 |
| 17 /* patch */ StackTrace get stackTrace => _stackTrace; | 17 /* patch */ StackTrace get stackTrace => _stackTrace; |
| 18 | 18 |
| 19 StackTrace _stackTrace; | 19 StackTrace _stackTrace; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class _AssertionError extends Error implements AssertionError { | 22 class _AssertionError extends Error implements AssertionError { |
| 23 _AssertionError._create( | 23 _AssertionError._create( |
| 24 this._failedAssertion, this._url, this._line, this._column); | 24 this._failedAssertion, this._url, this._line, this._column); |
| 25 | 25 |
| 26 static _throwNew(int assertionStart, int assertionEnd) | 26 static _throwNew(int assertionStart, int assertionEnd) |
| 27 native "AssertionError_throwNew"; | 27 native "AssertionError_throwNew"; |
| 28 | 28 |
| 29 static _handleCondition(condition) { | |
|
hausner
2016/06/14 17:51:31
I'd call this function _evaluateCondition(), or so
| |
| 30 if (condition is Function) return condition(); | |
| 31 return condition; | |
| 32 } | |
| 33 | |
| 29 String toString() { | 34 String toString() { |
| 30 if (_url == null) { | 35 if (_url == null) { |
| 31 return _failedAssertion; | 36 return _failedAssertion; |
| 32 } | 37 } |
| 33 var columnInfo = ""; | 38 var columnInfo = ""; |
| 34 if (_column > 0) { | 39 if (_column > 0) { |
| 35 // Only add column information if it is valid. | 40 // Only add column information if it is valid. |
| 36 columnInfo = " pos $_column"; | 41 columnInfo = " pos $_column"; |
| 37 } | 42 } |
| 38 return "'$_url': Failed assertion: line $_line$columnInfo: " | 43 return "'$_url': Failed assertion: line $_line$columnInfo: " |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 msg_buf.write( | 341 msg_buf.write( |
| 337 "NoSuchMethodError: incorrect number of arguments passed to " | 342 "NoSuchMethodError: incorrect number of arguments passed to " |
| 338 "method named '$memberName'\n" | 343 "method named '$memberName'\n" |
| 339 "Receiver: $receiver_str\n" | 344 "Receiver: $receiver_str\n" |
| 340 "Tried calling: $memberName($actualParameters)\n" | 345 "Tried calling: $memberName($actualParameters)\n" |
| 341 "Found: $memberName($formalParameters)"); | 346 "Found: $memberName($formalParameters)"); |
| 342 } | 347 } |
| 343 return msg_buf.toString(); | 348 return msg_buf.toString(); |
| 344 } | 349 } |
| 345 } | 350 } |
| OLD | NEW |