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 // Mocks of things that Leg cannot read directly. | 5 // Mocks of things that Leg cannot read directly. |
| 6 | 6 |
| 7 // TODO(ahe): Remove this file. | 7 // TODO(ahe): Remove this file. |
| 8 | 8 |
| 9 class TypeError extends AssertionError { | 9 class TypeErrorImplementation implements TypeError { |
|
Mads Ager (google)
2012/08/28 16:01:46
How about putting these in errors.dart. That will
| |
| 10 final String msg; | 10 final String msg; |
| 11 const TypeError(String this.msg); | 11 const TypeErrorImplementation(String this.msg); |
| 12 String toString() => msg; | 12 String toString() => msg; |
| 13 } | 13 } |
| 14 | 14 |
| 15 /** Thrown by the 'as' operator if the cast isn't valid. */ | 15 /** Thrown by the 'as' operator if the cast isn't valid. */ |
| 16 class CastException implements TypeError { | 16 class CastExceptionImplementation implements CastException { |
| 17 // TODO(lrn): Change actualType and expectedType to "Type" when reified | 17 // TODO(lrn): Change actualType and expectedType to "Type" when reified |
| 18 // types are available. | 18 // types are available. |
| 19 final Object actualType; | 19 final Object actualType; |
| 20 final Object expectedType; | 20 final Object expectedType; |
| 21 | 21 |
| 22 CastException(this.actualType, this.expectedType); | 22 CastExceptionImplementation(this.actualType, this.expectedType); |
| 23 | 23 |
| 24 String toString() { | 24 String toString() { |
| 25 return "CastException: Casting value of type $actualType to" | 25 return "CastException: Casting value of type $actualType to" |
| 26 " incompatible type $expectedType"; | 26 " incompatible type $expectedType"; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 class FallThroughError { | 30 class FallThroughError { |
| 31 const FallThroughError(); | 31 const FallThroughError(); |
| 32 String toString() => "Switch case fall-through."; | 32 String toString() => "Switch case fall-through."; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 50 // TODO(ahe): Not sure ByteArray belongs in the core library. | 50 // TODO(ahe): Not sure ByteArray belongs in the core library. |
| 51 interface Uint8List extends List default _InternalByteArray { | 51 interface Uint8List extends List default _InternalByteArray { |
| 52 Uint8List(int length); | 52 Uint8List(int length); |
| 53 } | 53 } |
| 54 | 54 |
| 55 class _InternalByteArray { | 55 class _InternalByteArray { |
| 56 factory Uint8List(int length) { | 56 factory Uint8List(int length) { |
| 57 throw new UnsupportedOperationException("new Uint8List($length)"); | 57 throw new UnsupportedOperationException("new Uint8List($length)"); |
| 58 } | 58 } |
| 59 } | 59 } |
| OLD | NEW |