| 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 // Errors are created and thrown by DartVM only. | 4 // Errors are created and thrown by DartVM only. |
| 5 // Changes here should also be reflected in corelib/error.dart as well | 5 // Changes here should also be reflected in corelib/error.dart as well |
| 6 | 6 |
| 7 class AssertionErrorImplementation implements AssertionError { | 7 class AssertionErrorImplementation implements AssertionError { |
| 8 factory AssertionErrorImplementation._uninstantiable() { | 8 factory AssertionErrorImplementation._uninstantiable() { |
| 9 throw const UnsupportedOperationException( | 9 throw const UnsupportedOperationException( |
| 10 "AssertionError can only be allocated by the VM"); | 10 "AssertionError can only be allocated by the VM"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 str = "${str}malformed type used."; | 43 str = "${str}malformed type used."; |
| 44 } | 44 } |
| 45 return str; | 45 return str; |
| 46 } | 46 } |
| 47 final String srcType; | 47 final String srcType; |
| 48 final String dstType; | 48 final String dstType; |
| 49 final String dstName; | 49 final String dstName; |
| 50 final String malformedError; | 50 final String malformedError; |
| 51 } | 51 } |
| 52 | 52 |
| 53 class CastExceptionImplementation | 53 class CastErrorImplementation |
| 54 extends TypeErrorImplementation | 54 extends TypeErrorImplementation |
| 55 implements CastException { | 55 implements CastError { |
| 56 factory CastException._uninstantiable() { | 56 factory CastError._uninstantiable() { |
| 57 throw const UnsupportedOperationException( | 57 throw const UnsupportedOperationException( |
| 58 "CastException can only be allocated by the VM"); | 58 "CastError can only be allocated by the VM"); |
| 59 } | 59 } |
| 60 // A CastException is allocated by TypeError._throwNew() when dst_name equals | 60 // A CastError is allocated by TypeError._throwNew() when dst_name equals |
| 61 // Exceptions::kCastExceptionDstName. | 61 // Exceptions::kCastErrorDstName. |
| 62 String toString() { | 62 String toString() { |
| 63 String str = (malformedError != null) ? malformedError : ""; | 63 String str = (malformedError != null) ? malformedError : ""; |
| 64 if ((dstName != null) && (dstName.length > 0)) { | 64 if ((dstName != null) && (dstName.length > 0)) { |
| 65 str = "${str}type '$srcType' is not a subtype of " | 65 str = "${str}type '$srcType' is not a subtype of " |
| 66 "type '$dstType' in type cast."; | 66 "type '$dstType' in type cast."; |
| 67 } else { | 67 } else { |
| 68 str = "${str}malformed type used in type cast."; | 68 str = "${str}malformed type used in type cast."; |
| 69 } | 69 } |
| 70 return str; | 70 return str; |
| 71 } | 71 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 String toString() { | 123 String toString() { |
| 124 return "Cannot instantiate abstract class $className: " | 124 return "Cannot instantiate abstract class $className: " |
| 125 "url '$url' line $line"; | 125 "url '$url' line $line"; |
| 126 } | 126 } |
| 127 | 127 |
| 128 final String className; | 128 final String className; |
| 129 final String url; | 129 final String url; |
| 130 final int line; | 130 final int line; |
| 131 } | 131 } |
| OLD | NEW |