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 extends AssertionError { |
8 factory AssertionErrorImplementation._uninstantiable() { | 8 factory AssertionErrorImplementation._uninstantiable() { |
9 throw new UnsupportedError( | 9 throw new UnsupportedError( |
10 "AssertionError can only be allocated by the VM"); | 10 "AssertionError can only be allocated by the VM"); |
11 } | 11 } |
12 static _throwNew(int assertionStart, int assertionEnd) | 12 static _throwNew(int assertionStart, int assertionEnd) |
13 native "AssertionError_throwNew"; | 13 native "AssertionError_throwNew"; |
14 String toString() { | 14 String toString() { |
15 return "'$url': Failed assertion: line $line pos $column: " | 15 return "'$url': Failed assertion: line $line pos $column: " |
16 "'$failedAssertion' is not true."; | 16 "'$failedAssertion' is not true."; |
17 } | 17 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
72 } | 72 } |
73 | 73 |
74 class FallThroughErrorImplementation implements FallThroughError { | 74 class FallThroughErrorImplementation extends FallThroughError { |
75 factory FallThroughErrorImplementation._uninstantiable() { | 75 factory FallThroughErrorImplementation._uninstantiable() { |
76 throw new UnsupportedError( | 76 throw new UnsupportedError( |
77 "FallThroughError can only be allocated by the VM"); | 77 "FallThroughError can only be allocated by the VM"); |
78 } | 78 } |
79 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 79 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; |
80 String toString() { | 80 String toString() { |
81 return "'$url': Switch case fall-through at line $line."; | 81 return "'$url': Switch case fall-through at line $line."; |
82 } | 82 } |
83 final String url; | 83 final String url; |
84 final int line; | 84 final int line; |
85 } | 85 } |
86 | 86 |
87 class InternalError { | 87 class InternalError { |
88 const InternalError(this._msg); | 88 const InternalError(this._msg); |
89 String toString() => "InternalError: '${_msg}'"; | 89 String toString() => "InternalError: '${_msg}'"; |
90 final String _msg; | 90 final String _msg; |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 class AbstractClassInstantiationErrorImplementation | 94 class AbstractClassInstantiationErrorImplementation |
95 implements AbstractClassInstantiationError { | 95 extends AbstractClassInstantiationError { |
96 | 96 |
97 factory AbstractClassInstantiationErrorImplementation._uninstantiable() { | 97 factory AbstractClassInstantiationErrorImplementation._uninstantiable() { |
98 throw new UnsupportedError( | 98 throw new UnsupportedError( |
99 "AbstractClassInstantiationError can only be allocated by the VM"); | 99 "AbstractClassInstantiationError can only be allocated by the VM"); |
100 } | 100 } |
101 | 101 |
102 static _throwNew(int case_clause_pos, String className) | 102 static _throwNew(int case_clause_pos, String className) |
103 native "AbstractClassInstantiationError_throwNew"; | 103 native "AbstractClassInstantiationError_throwNew"; |
104 | 104 |
105 String toString() { | 105 String toString() { |
106 return "Cannot instantiate abstract class $className: " | 106 return "Cannot instantiate abstract class $className: " |
107 "url '$url' line $line"; | 107 "url '$url' line $line"; |
108 } | 108 } |
109 | 109 |
110 final String className; | 110 final String className; |
111 final String url; | 111 final String url; |
112 final int line; | 112 final int line; |
113 } | 113 } |
OLD | NEW |