| 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 AssertionError { | 7 class AssertionError { |
| 8 factory AssertionError._uninstantiable() { | 8 factory AssertionError._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 15 matching lines...) Expand all Loading... |
| 26 throw const UnsupportedOperationException( | 26 throw const UnsupportedOperationException( |
| 27 "TypeError can only be allocated by the VM"); | 27 "TypeError can only be allocated by the VM"); |
| 28 } | 28 } |
| 29 static _throwNew(int location, | 29 static _throwNew(int location, |
| 30 Object src_value, | 30 Object src_value, |
| 31 String dst_type_name, | 31 String dst_type_name, |
| 32 String dst_name, | 32 String dst_name, |
| 33 String malformed_error) | 33 String malformed_error) |
| 34 native "TypeError_throwNew"; | 34 native "TypeError_throwNew"; |
| 35 String toString() { | 35 String toString() { |
| 36 if (malformedError != null) { | 36 String str = (malformedError != null) ? malformedError : ""; |
| 37 return malformedError; | 37 if ((dstName != null) && (dstName.length > 0)) { |
| 38 str = str + |
| 39 "type '$srcType' is not assignable to type '$dstType' of '$dstName'."; |
| 40 } else { |
| 41 str = str + "malformed type used in type test."; |
| 38 } | 42 } |
| 39 return "'$url': Failed type check: line $line pos $column: " + | 43 return str; |
| 40 "type '$srcType' is not assignable to type '$dstType' of '$dstName'."; | |
| 41 } | 44 } |
| 42 final String srcType; | 45 final String srcType; |
| 43 final String dstType; | 46 final String dstType; |
| 44 final String dstName; | 47 final String dstName; |
| 45 final String malformedError; | 48 final String malformedError; |
| 46 } | 49 } |
| 47 | 50 |
| 48 class FallThroughError { | 51 class FallThroughError { |
| 49 factory FallThroughError._uninstantiable() { | 52 factory FallThroughError._uninstantiable() { |
| 50 throw const UnsupportedOperationException( | 53 throw const UnsupportedOperationException( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 74 String toString() => "Unresolved static method: url '$url' line $line " + | 77 String toString() => "Unresolved static method: url '$url' line $line " + |
| 75 "pos $column\n$failedResolutionLine\n"; | 78 "pos $column\n$failedResolutionLine\n"; |
| 76 | 79 |
| 77 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; | 80 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; |
| 78 | 81 |
| 79 final String failedResolutionLine; | 82 final String failedResolutionLine; |
| 80 final String url; | 83 final String url; |
| 81 final int line; | 84 final int line; |
| 82 final int column; | 85 final int column; |
| 83 } | 86 } |
| OLD | NEW |