OLD | NEW |
1 dart_library.library('try_catch', null, /* Imports */[ | 1 dart_library.library('try_catch', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart_sdk' |
3 'dart/core' | 3 ], function(exports, dart_sdk) { |
4 ], /* Lazy imports */[ | |
5 ], function(exports, dart, core) { | |
6 'use strict'; | 4 'use strict'; |
7 let dartx = dart.dartx; | 5 const core = dart_sdk.core; |
8 function foo() { | 6 const dart = dart_sdk.dart; |
| 7 const dartx = dart_sdk.dartx; |
| 8 const try_catch = Object.create(null); |
| 9 try_catch.foo = function() { |
9 try { | 10 try { |
10 dart.throw("hi there"); | 11 dart.throw("hi there"); |
11 } catch (e$) { | 12 } catch (e$) { |
12 if (dart.is(e$, core.String)) { | 13 if (dart.is(e$, core.String)) { |
13 let e = e$; | 14 let e = e$; |
14 let t = dart.stackTrace(e); | 15 let t = dart.stackTrace(e); |
15 } else { | 16 } else { |
16 let e = e$; | 17 let e = e$; |
17 let t = dart.stackTrace(e); | 18 let t = dart.stackTrace(e); |
18 throw e; | 19 throw e; |
19 } | 20 } |
20 } | 21 } |
21 | 22 |
22 } | 23 }; |
23 dart.fn(foo); | 24 dart.fn(try_catch.foo); |
24 function bar() { | 25 try_catch.bar = function() { |
25 try { | 26 try { |
26 dart.throw("hi there"); | 27 dart.throw("hi there"); |
27 } catch (e$) { | 28 } catch (e$) { |
28 let e = e$; | 29 let e = e$; |
29 let t = dart.stackTrace(e); | 30 let t = dart.stackTrace(e); |
30 } | 31 } |
31 | 32 |
32 } | 33 }; |
33 dart.fn(bar); | 34 dart.fn(try_catch.bar); |
34 function baz() { | 35 try_catch.baz = function() { |
35 try { | 36 try { |
36 dart.throw("finally only"); | 37 dart.throw("finally only"); |
37 } finally { | 38 } finally { |
38 return true; | 39 return true; |
39 } | 40 } |
40 } | 41 }; |
41 dart.fn(baz); | 42 dart.fn(try_catch.baz); |
42 function qux() { | 43 try_catch.qux = function() { |
43 try { | 44 try { |
44 dart.throw("on only"); | 45 dart.throw("on only"); |
45 } catch (e) { | 46 } catch (e) { |
46 if (dart.is(e, core.String)) { | 47 if (dart.is(e, core.String)) { |
47 let t = dart.stackTrace(e); | 48 let t = dart.stackTrace(e); |
48 throw e; | 49 throw e; |
49 } else | 50 } else |
50 throw e; | 51 throw e; |
51 } | 52 } |
52 | 53 |
53 } | 54 }; |
54 dart.fn(qux); | 55 dart.fn(try_catch.qux); |
55 function wub() { | 56 try_catch.wub = function() { |
56 try { | 57 try { |
57 dart.throw("on without exception parameter"); | 58 dart.throw("on without exception parameter"); |
58 } catch (e) { | 59 } catch (e) { |
59 if (dart.is(e, core.String)) { | 60 if (dart.is(e, core.String)) { |
60 } else | 61 } else |
61 throw e; | 62 throw e; |
62 } | 63 } |
63 | 64 |
64 } | 65 }; |
65 dart.fn(wub); | 66 dart.fn(try_catch.wub); |
66 function main() { | 67 try_catch.main = function() { |
67 foo(); | 68 try_catch.foo(); |
68 bar(); | 69 try_catch.bar(); |
69 baz(); | 70 try_catch.baz(); |
70 qux(); | 71 try_catch.qux(); |
71 wub(); | 72 try_catch.wub(); |
72 } | 73 }; |
73 dart.fn(main); | 74 dart.fn(try_catch.main); |
74 // Exports: | 75 // Exports: |
75 exports.foo = foo; | 76 exports.try_catch = try_catch; |
76 exports.bar = bar; | |
77 exports.baz = baz; | |
78 exports.qux = qux; | |
79 exports.wub = wub; | |
80 exports.main = main; | |
81 }); | 77 }); |
OLD | NEW |