| 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 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 final String _failedAssertion; | 26 final String _failedAssertion; |
| 27 final String _url; | 27 final String _url; |
| 28 final int _line; | 28 final int _line; |
| 29 final int _column; | 29 final int _column; |
| 30 } | 30 } |
| 31 | 31 |
| 32 patch class TypeError extends AssertionError { | 32 patch class TypeError extends AssertionError { |
| 33 TypeError._create(String url, int line, int column, | 33 TypeError._create(String url, int line, int column, |
| 34 this._srcType, this._dstType, this._dstName, | 34 this._srcType, this._dstType, this._dstName, |
| 35 this._malformedError) | 35 this._boundError) |
| 36 : super._create("is assignable", url, line, column); | 36 : super._create("is assignable", url, line, column); |
| 37 | 37 |
| 38 static _throwNew(int location, | 38 static _throwNew(int location, |
| 39 Object src_value, | 39 Object src_value, |
| 40 String dst_type_name, | 40 String dst_type_name, |
| 41 String dst_name, | 41 String dst_name, |
| 42 String malformed_error) | 42 String bound_error) |
| 43 native "TypeError_throwNew"; | 43 native "TypeError_throwNew"; |
| 44 | 44 |
| 45 String toString() { | 45 String toString() { |
| 46 String str = (_malformedError != null) ? _malformedError : ""; | 46 String str = (_boundError != null) ? _boundError : ""; |
| 47 if ((_dstName != null) && (_dstName.length > 0)) { | 47 if ((_dstName != null) && (_dstName.length > 0)) { |
| 48 str = "${str}type '$_srcType' is not a subtype of " | 48 str = "${str}type '$_srcType' is not a subtype of " |
| 49 "type '$_dstType' of '$_dstName'."; | 49 "type '$_dstType' of '$_dstName'."; |
| 50 } else { | 50 } else { |
| 51 str = "${str}malformed type used."; | 51 str = "${str}malbounded type used."; |
| 52 } | 52 } |
| 53 return str; | 53 return str; |
| 54 } | 54 } |
| 55 | 55 |
| 56 final String _srcType; | 56 final String _srcType; |
| 57 final String _dstType; | 57 final String _dstType; |
| 58 final String _dstName; | 58 final String _dstName; |
| 59 final String _malformedError; | 59 final String _boundError; |
| 60 } | 60 } |
| 61 | 61 |
| 62 patch class CastError extends Error { | 62 patch class CastError extends Error { |
| 63 CastError._create(this._url, this._line, this._column, | 63 CastError._create(this._url, this._line, this._column, |
| 64 this._srcType, this._dstType, this._dstName, | 64 this._srcType, this._dstType, this._dstName, |
| 65 this._malformedError); | 65 this._boundError); |
| 66 | 66 |
| 67 // A CastError is allocated by TypeError._throwNew() when dst_name equals | 67 // A CastError is allocated by TypeError._throwNew() when dst_name equals |
| 68 // Exceptions::kCastErrorDstName. | 68 // Exceptions::kCastErrorDstName. |
| 69 | 69 |
| 70 String toString() { | 70 String toString() { |
| 71 String str = (_malformedError != null) ? _malformedError : ""; | 71 String str = (_boundError != null) ? _boundError : ""; |
| 72 str = "${str}type '$_srcType' is not a subtype of " | 72 str = "${str}type '$_srcType' is not a subtype of " |
| 73 "type '$_dstType' in type cast."; | 73 "type '$_dstType' in type cast."; |
| 74 return str; | 74 return str; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Fields _url, _line, and _column are only used for debugging purposes. | 77 // Fields _url, _line, and _column are only used for debugging purposes. |
| 78 final String _url; | 78 final String _url; |
| 79 final int _line; | 79 final int _line; |
| 80 final int _column; | 80 final int _column; |
| 81 final String _srcType; | 81 final String _srcType; |
| 82 final String _dstType; | 82 final String _dstType; |
| 83 final String _dstName; | 83 final String _dstName; |
| 84 final String _malformedError; | 84 final String _boundError; |
| 85 } | 85 } |
| 86 | 86 |
| 87 patch class FallThroughError { | 87 patch class FallThroughError { |
| 88 FallThroughError._create(this._url, this._line); | 88 FallThroughError._create(this._url, this._line); |
| 89 | 89 |
| 90 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 90 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; |
| 91 | 91 |
| 92 /* patch */ String toString() { | 92 /* patch */ String toString() { |
| 93 return "'$_url': Switch case fall-through at line $_line."; | 93 return "'$_url': Switch case fall-through at line $_line."; |
| 94 } | 94 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 return msg_buf.toString(); | 304 return msg_buf.toString(); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 class _JavascriptIntegerOverflowError extends Error { | 308 class _JavascriptIntegerOverflowError extends Error { |
| 309 final Object _value; | 309 final Object _value; |
| 310 | 310 |
| 311 _JavascriptIntegerOverflowError(this._value); | 311 _JavascriptIntegerOverflowError(this._value); |
| 312 String toString() => "Javascript Integer Overflow: $_value"; | 312 String toString() => "Javascript Integer Overflow: $_value"; |
| 313 } | 313 } |
| OLD | NEW |