OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/exception_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__exception_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const exception_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 exception_test.ExceptionTest = class ExceptionTest extends core.Object { |
| 13 static testMain() { |
| 14 let i = 0; |
| 15 try { |
| 16 dart.throw("Hello"); |
| 17 } catch (s) { |
| 18 if (core.String.is(s)) { |
| 19 core.print(s); |
| 20 i = i + 10; |
| 21 } else |
| 22 throw s; |
| 23 } |
| 24 |
| 25 try { |
| 26 dart.throw("bye"); |
| 27 } catch (s) { |
| 28 if (core.String.is(s)) { |
| 29 core.print(s); |
| 30 i = i + 10; |
| 31 } else |
| 32 throw s; |
| 33 } |
| 34 |
| 35 expect$.Expect.equals(20, i); |
| 36 let correctCatch = false; |
| 37 try { |
| 38 dart.throw(null); |
| 39 } catch (e$) { |
| 40 if (core.String.is(e$)) { |
| 41 let s = e$; |
| 42 correctCatch = false; |
| 43 } else if (core.NullThrownError.is(e$)) { |
| 44 let e = e$; |
| 45 correctCatch = true; |
| 46 } else { |
| 47 let x = e$; |
| 48 correctCatch = false; |
| 49 } |
| 50 } |
| 51 |
| 52 expect$.Expect.isTrue(correctCatch); |
| 53 } |
| 54 }; |
| 55 dart.setSignature(exception_test.ExceptionTest, { |
| 56 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), |
| 57 names: ['testMain'] |
| 58 }); |
| 59 exception_test.main = function() { |
| 60 exception_test.ExceptionTest.testMain(); |
| 61 }; |
| 62 dart.fn(exception_test.main, VoidTodynamic()); |
| 63 // Exports: |
| 64 exports.exception_test = exception_test; |
| 65 }); |
OLD | NEW |