OLD | NEW |
(Empty) | |
| 1 library; |
| 2 import self as self; |
| 3 import "dart:core" as core; |
| 4 |
| 5 class Closure#f_1_1_no_default extends core::Object implements core::Function { |
| 6 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 7 constructor •() → dynamic |
| 8 ; |
| 9 method call(dynamic a, [dynamic b]) → dynamic |
| 10 return self::f_1_1_no_default(a, b); |
| 11 } |
| 12 class Closure#f_1_1_default extends core::Object implements core::Function { |
| 13 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 14 constructor •() → dynamic |
| 15 ; |
| 16 method call(dynamic a, [dynamic b = 2]) → dynamic |
| 17 return self::f_1_1_default(a, b); |
| 18 } |
| 19 class Closure#f_1_b_no_default extends core::Object implements core::Function { |
| 20 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 21 constructor •() → dynamic |
| 22 ; |
| 23 method call(dynamic a, {dynamic b}) → dynamic |
| 24 return self::f_1_b_no_default(a, b: b); |
| 25 } |
| 26 class Closure#f_1_b_default extends core::Object implements core::Function { |
| 27 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 28 constructor •() → dynamic |
| 29 ; |
| 30 method call(dynamic a, {dynamic b = 2}) → dynamic |
| 31 return self::f_1_b_default(a, b: b); |
| 32 } |
| 33 static method f_1_1_no_default(dynamic a, [dynamic b]) → dynamic { |
| 34 return a.+(b); |
| 35 } |
| 36 static method f_1_1_default(dynamic a, [dynamic b = 2]) → dynamic { |
| 37 return a.+(b); |
| 38 } |
| 39 static method f_1_b_no_default(dynamic a, {dynamic b}) → dynamic { |
| 40 return a.+(b); |
| 41 } |
| 42 static method f_1_b_default(dynamic a, {dynamic b = 2}) → dynamic { |
| 43 return a.+(b); |
| 44 } |
| 45 static method test_1_1(core::Function f, core::bool hasDefault) → dynamic { |
| 46 dynamic result = f.call(40, 2); |
| 47 if(!42.==(result)) |
| 48 throw "Unexpected result: ${result}"; |
| 49 self::test_1(f, hasDefault); |
| 50 } |
| 51 static method test_1_b(core::Function f, core::bool hasDefault) → dynamic { |
| 52 dynamic result = f.call(40, b: 2); |
| 53 if(!42.==(result)) |
| 54 throw "Unexpected result: ${result}"; |
| 55 self::test_1(f, hasDefault); |
| 56 } |
| 57 static method test_1(core::Function f, core::bool hasDefault) → dynamic { |
| 58 dynamic result = 0; |
| 59 core::bool threw = true; |
| 60 try { |
| 61 result = f.call(40); |
| 62 threw = false; |
| 63 } |
| 64 on dynamic catch(dynamic _) { |
| 65 } |
| 66 if(hasDefault) { |
| 67 if(threw) |
| 68 throw "Unexpected exception."; |
| 69 if(!42.==(result)) |
| 70 throw "Unexpected result: ${result}."; |
| 71 } |
| 72 else { |
| 73 if(!threw) |
| 74 throw "Expected exception missing."; |
| 75 if(!0.==(result)) |
| 76 throw "Unexpected result: ${result}."; |
| 77 } |
| 78 } |
| 79 static method main(dynamic arguments) → dynamic { |
| 80 self::test_1_1(new self::Closure#f_1_1_no_default::•(), false); |
| 81 self::test_1_1(new self::Closure#f_1_1_default::•(), true); |
| 82 self::test_1_b(new self::Closure#f_1_b_no_default::•(), false); |
| 83 self::test_1_b(new self::Closure#f_1_b_default::•(), true); |
| 84 } |
OLD | NEW |