OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/getter_closure_execution_order_test', null, /* Im
ports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__getter_closure_execution_order_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 getter_closure_execution_order_test = Object.create(null); |
| 11 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 getter_closure_execution_order_test.counter = 0; |
| 14 getter_closure_execution_order_test.Test1 = class Test1 extends core.Object { |
| 15 get a() { |
| 16 expect$.Expect.equals(1, getter_closure_execution_order_test.counter); |
| 17 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_
execution_order_test.counter) + 1; |
| 18 return dart.fn(c => { |
| 19 }, dynamicTodynamic()); |
| 20 } |
| 21 b() { |
| 22 expect$.Expect.equals(0, getter_closure_execution_order_test.counter); |
| 23 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_
execution_order_test.counter) + 1; |
| 24 return 1; |
| 25 } |
| 26 }; |
| 27 dart.setSignature(getter_closure_execution_order_test.Test1, { |
| 28 methods: () => ({b: dart.definiteFunctionType(dart.dynamic, [])}) |
| 29 }); |
| 30 getter_closure_execution_order_test.Test2 = class Test2 extends core.Object { |
| 31 static get a() { |
| 32 expect$.Expect.equals(0, getter_closure_execution_order_test.counter); |
| 33 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_
execution_order_test.counter) + 1; |
| 34 return dart.fn(c => { |
| 35 }, dynamicTodynamic()); |
| 36 } |
| 37 static b() { |
| 38 expect$.Expect.equals(1, getter_closure_execution_order_test.counter); |
| 39 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_
execution_order_test.counter) + 1; |
| 40 return 1; |
| 41 } |
| 42 }; |
| 43 dart.setSignature(getter_closure_execution_order_test.Test2, { |
| 44 statics: () => ({b: dart.definiteFunctionType(dart.dynamic, [])}), |
| 45 names: ['b'] |
| 46 }); |
| 47 dart.copyProperties(getter_closure_execution_order_test, { |
| 48 get a() { |
| 49 expect$.Expect.equals(0, getter_closure_execution_order_test.counter); |
| 50 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_
execution_order_test.counter) + 1; |
| 51 return dart.fn(c => { |
| 52 }, dynamicTodynamic()); |
| 53 } |
| 54 }); |
| 55 getter_closure_execution_order_test.b = function() { |
| 56 expect$.Expect.equals(1, getter_closure_execution_order_test.counter); |
| 57 getter_closure_execution_order_test.counter = dart.notNull(getter_closure_ex
ecution_order_test.counter) + 1; |
| 58 return 1; |
| 59 }; |
| 60 dart.fn(getter_closure_execution_order_test.b, VoidTodynamic()); |
| 61 getter_closure_execution_order_test.main = function() { |
| 62 let failures = []; |
| 63 try { |
| 64 getter_closure_execution_order_test.counter = 0; |
| 65 let o = new getter_closure_execution_order_test.Test1(); |
| 66 dart.dsend(o, 'a', o.b()); |
| 67 expect$.Expect.equals(2, getter_closure_execution_order_test.counter); |
| 68 } catch (exc) { |
| 69 let stack = dart.stackTrace(exc); |
| 70 failures[dartx.add](exc); |
| 71 failures[dartx.add](stack); |
| 72 } |
| 73 |
| 74 try { |
| 75 getter_closure_execution_order_test.counter = 0; |
| 76 dart.dsend(getter_closure_execution_order_test.Test2, 'a', getter_closure_
execution_order_test.Test2.b()); |
| 77 expect$.Expect.equals(2, getter_closure_execution_order_test.counter); |
| 78 } catch (exc) { |
| 79 let stack = dart.stackTrace(exc); |
| 80 failures[dartx.add](exc); |
| 81 failures[dartx.add](stack); |
| 82 } |
| 83 |
| 84 try { |
| 85 getter_closure_execution_order_test.counter = 0; |
| 86 dart.dcall(getter_closure_execution_order_test.a, getter_closure_execution
_order_test.b()); |
| 87 expect$.Expect.equals(2, getter_closure_execution_order_test.counter); |
| 88 } catch (exc) { |
| 89 let stack = dart.stackTrace(exc); |
| 90 failures[dartx.add](exc); |
| 91 failures[dartx.add](stack); |
| 92 } |
| 93 |
| 94 if (failures[dartx.length] != 0) { |
| 95 for (let msg of failures) { |
| 96 core.print(dart.toString(msg)); |
| 97 } |
| 98 dart.throw(dart.str`${(dart.notNull(failures[dartx.length]) / 2)[dartx.tru
ncate]()} tests failed.`); |
| 99 } |
| 100 }; |
| 101 dart.fn(getter_closure_execution_order_test.main, VoidTodynamic()); |
| 102 // Exports: |
| 103 exports.getter_closure_execution_order_test = getter_closure_execution_order_t
est; |
| 104 }); |
OLD | NEW |