OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of dart._runtime; | 4 part of dart._runtime; |
5 | 5 |
6 throwCastError(actual, type) => JS('', '''(() => { | 6 throwCastError(object, actual, type) => JS('', '''(() => { |
7 $throw_(new $CastErrorImplementation($typeName($actual), | 7 $throw_(new $CastErrorImplementation($object, |
| 8 $typeName($actual), |
8 $typeName($type))); | 9 $typeName($type))); |
9 })()'''); | 10 })()'''); |
10 | 11 |
| 12 throwTypeError(object, actual, type) => JS('', '''(() => { |
| 13 $throw_(new $TypeErrorImplementation($object, |
| 14 $typeName($actual), |
| 15 $typeName($type))); |
| 16 })()'''); |
| 17 |
| 18 throwStrongModeCastError(object, actual, type) => JS('', '''(() => { |
| 19 $throw_(new $StrongModeCastError($object, |
| 20 $typeName($actual), |
| 21 $typeName($type))); |
| 22 })()'''); |
| 23 |
| 24 throwStrongModeTypeError(object, actual, type) => JS('', '''(() => { |
| 25 $throw_(new $StrongModeTypeError($object, |
| 26 $typeName($actual), |
| 27 $typeName($type))); |
| 28 })()'''); |
| 29 |
11 throwAssertionError() => JS('', '''(() => { | 30 throwAssertionError() => JS('', '''(() => { |
12 $throw_(new $AssertionError()); | 31 $throw_(new $AssertionError()); |
13 })()'''); | 32 })()'''); |
14 | 33 |
15 throwNullValueError() => JS('', '''(() => { | 34 throwNullValueError() => JS('', '''(() => { |
16 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought | 35 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought |
17 // to thread through method info, but that uglifies the code and can't | 36 // to thread through method info, but that uglifies the code and can't |
18 // actually be queried ... it only affects how the error is printed. | 37 // actually be queried ... it only affects how the error is printed. |
19 $throw_(new $NoSuchMethodError(null, | 38 $throw_(new $NoSuchMethodError(null, |
20 new $Symbol('<Unexpected Null Value>'), null, null, null)); | 39 new $Symbol('<Unexpected Null Value>'), null, null, null)); |
21 })()'''); | 40 })()'''); |
OLD | NEW |