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 // TODO(ahe): VM specfic exception? | |
10 class InternalError { | |
11 const InternalError(this._msg); | |
12 String toString() => "InternalError: '${_msg}'"; | |
13 final String _msg; | |
14 } | |
15 | |
16 // TODO(ahe): VM specfic exception? | |
17 class StaticResolutionException implements Exception {} | |
18 | |
19 void assert(condition) { | 9 void assert(condition) { |
20 if (condition is Function) condition = condition(); | 10 if (condition is Function) condition = condition(); |
21 if (!condition) throw new AssertionError(); | 11 if (!condition) throw new AssertionError(); |
22 } | 12 } |
23 | 13 |
24 // TODO(ahe): Not sure ByteArray belongs in the core library. | 14 // TODO(ahe): Not sure ByteArray belongs in the core library. |
25 interface Uint8List extends List default _InternalByteArray { | 15 interface Uint8List extends List default _InternalByteArray { |
26 Uint8List(int length); | 16 Uint8List(int length); |
27 } | 17 } |
28 | 18 |
29 class _InternalByteArray { | 19 class _InternalByteArray { |
30 factory Uint8List(int length) { | 20 factory Uint8List(int length) { |
31 throw new UnsupportedOperationException("new Uint8List($length)"); | 21 throw new UnsupportedOperationException("new Uint8List($length)"); |
32 } | 22 } |
33 } | 23 } |
OLD | NEW |