OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/try_catch2_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__try_catch2_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 try_catch2_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 try_catch2_test.TestException = class TestException extends core.Object {}; |
| 13 try_catch2_test.MyException = class MyException extends core.Object { |
| 14 new(message) { |
| 15 if (message === void 0) message = ""; |
| 16 this.message_ = message; |
| 17 } |
| 18 getMessage() { |
| 19 return this.message_; |
| 20 } |
| 21 }; |
| 22 try_catch2_test.MyException[dart.implements] = () => [try_catch2_test.TestExce
ption]; |
| 23 dart.setSignature(try_catch2_test.MyException, { |
| 24 constructors: () => ({new: dart.definiteFunctionType(try_catch2_test.MyExcep
tion, [], [core.String])}), |
| 25 methods: () => ({getMessage: dart.definiteFunctionType(core.String, [])}) |
| 26 }); |
| 27 try_catch2_test.StackTrace = class StackTrace extends core.Object { |
| 28 new() { |
| 29 } |
| 30 }; |
| 31 dart.setSignature(try_catch2_test.StackTrace, { |
| 32 constructors: () => ({new: dart.definiteFunctionType(try_catch2_test.StackTr
ace, [])}) |
| 33 }); |
| 34 try_catch2_test.Helper = class Helper extends core.Object { |
| 35 static f1(i) { |
| 36 try { |
| 37 let j = null; |
| 38 j = try_catch2_test.Helper.f2(); |
| 39 i = dart.notNull(i) + 1; |
| 40 try { |
| 41 j = dart.notNull(try_catch2_test.Helper.f2()) + dart.notNull(try_catch
2_test.Helper.f3()) + dart.notNull(j); |
| 42 i = dart.notNull(i) + 1; |
| 43 } catch (e) { |
| 44 if (try_catch2_test.TestException.is(e)) { |
| 45 let trace = dart.stackTrace(e); |
| 46 j = 50; |
| 47 } else |
| 48 throw e; |
| 49 } |
| 50 |
| 51 j = dart.notNull(try_catch2_test.Helper.f3()) + dart.notNull(j); |
| 52 } catch (e$) { |
| 53 if (try_catch2_test.MyException.is(e$)) { |
| 54 let exception = e$; |
| 55 i = 100; |
| 56 } else if (try_catch2_test.TestException.is(e$)) { |
| 57 let e = e$; |
| 58 let trace = dart.stackTrace(e); |
| 59 i = 200; |
| 60 } else |
| 61 throw e$; |
| 62 } |
| 63 |
| 64 return i; |
| 65 } |
| 66 static f2() { |
| 67 return 2; |
| 68 } |
| 69 static f3() { |
| 70 let i = 0; |
| 71 while (i < 10) { |
| 72 i++; |
| 73 } |
| 74 return i; |
| 75 } |
| 76 }; |
| 77 dart.setSignature(try_catch2_test.Helper, { |
| 78 statics: () => ({ |
| 79 f1: dart.definiteFunctionType(core.int, [core.int]), |
| 80 f2: dart.definiteFunctionType(core.int, []), |
| 81 f3: dart.definiteFunctionType(core.int, []) |
| 82 }), |
| 83 names: ['f1', 'f2', 'f3'] |
| 84 }); |
| 85 try_catch2_test.TryCatch2Test = class TryCatch2Test extends core.Object { |
| 86 static testMain() { |
| 87 expect$.Expect.equals(3, try_catch2_test.Helper.f1(1)); |
| 88 } |
| 89 }; |
| 90 dart.setSignature(try_catch2_test.TryCatch2Test, { |
| 91 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), |
| 92 names: ['testMain'] |
| 93 }); |
| 94 try_catch2_test.main = function() { |
| 95 for (let i = 0; i < 20; i++) { |
| 96 try_catch2_test.TryCatch2Test.testMain(); |
| 97 } |
| 98 }; |
| 99 dart.fn(try_catch2_test.main, VoidTodynamic()); |
| 100 // Exports: |
| 101 exports.try_catch2_test = try_catch2_test; |
| 102 }); |
OLD | NEW |