OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library _js_helper; | 5 library _js_helper; |
6 | 6 |
7 import 'dart:_js_embedded_names' | 7 import 'dart:_js_embedded_names' |
8 show | 8 show |
9 DEFERRED_LIBRARY_URIS, | 9 DEFERRED_LIBRARY_URIS, |
10 DEFERRED_LIBRARY_HASHES, | 10 DEFERRED_LIBRARY_HASHES, |
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 /** | 2240 /** |
2241 * Called from catch blocks in generated code to extract the Dart | 2241 * Called from catch blocks in generated code to extract the Dart |
2242 * exception from the thrown value. The thrown value may have been | 2242 * exception from the thrown value. The thrown value may have been |
2243 * created by [wrapException] or it may be a 'native' JS exception. | 2243 * created by [wrapException] or it may be a 'native' JS exception. |
2244 * | 2244 * |
2245 * Some native exceptions are mapped to new Dart instances, others are | 2245 * Some native exceptions are mapped to new Dart instances, others are |
2246 * returned unmodified. | 2246 * returned unmodified. |
2247 */ | 2247 */ |
2248 unwrapException(ex) { | 2248 unwrapException(ex) { |
2249 /// If error implements Error, save [ex] in [error.$thrownJsError]. | 2249 /// If error implements Error, save [ex] in [error.$thrownJsError]. |
2250 /// Otherwise, do nothing. Later, the stack trace can then be extraced from | 2250 /// Otherwise, do nothing. Later, the stack trace can then be extracted from |
2251 /// [ex]. | 2251 /// [ex]. |
2252 saveStackTrace(error) { | 2252 saveStackTrace(error) { |
2253 if (error is Error) { | 2253 if (error is Error) { |
2254 var thrownStackTrace = JS('', r'#.$thrownJsError', error); | 2254 var thrownStackTrace = JS('', r'#.$thrownJsError', error); |
2255 if (thrownStackTrace == null) { | 2255 if (thrownStackTrace == null) { |
2256 JS('void', r'#.$thrownJsError = #', error, ex); | 2256 JS('void', r'#.$thrownJsError = #', error, ex); |
2257 } | 2257 } |
2258 } | 2258 } |
2259 return error; | 2259 return error; |
2260 } | 2260 } |
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3805 // unneeded code. | 3805 // unneeded code. |
3806 class _UnreachableError extends AssertionError { | 3806 class _UnreachableError extends AssertionError { |
3807 _UnreachableError(); | 3807 _UnreachableError(); |
3808 String toString() => "Assertion failed: Reached dead code"; | 3808 String toString() => "Assertion failed: Reached dead code"; |
3809 } | 3809 } |
3810 | 3810 |
3811 @NoInline() | 3811 @NoInline() |
3812 void assertUnreachable() { | 3812 void assertUnreachable() { |
3813 throw new _UnreachableError(); | 3813 throw new _UnreachableError(); |
3814 } | 3814 } |
OLD | NEW |