OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/closure_shared_state_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__closure_shared_state_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 closure_shared_state_test = Object.create(null); |
| 11 let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.i
nt, [core.int])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 closure_shared_state_test.f = null; |
| 15 closure_shared_state_test.g = null; |
| 16 closure_shared_state_test.setupPlain = function() { |
| 17 let j = 1000; |
| 18 closure_shared_state_test.f = dart.fn(x => { |
| 19 let q = j; |
| 20 j = x; |
| 21 return q; |
| 22 }, intToint()); |
| 23 closure_shared_state_test.g = dart.fn(x => { |
| 24 let q = j; |
| 25 j = x; |
| 26 return q; |
| 27 }, intToint()); |
| 28 }; |
| 29 dart.fn(closure_shared_state_test.setupPlain, VoidTodynamic()); |
| 30 closure_shared_state_test.setupLoop = function() { |
| 31 for (let i = 0; i < 2; i++) { |
| 32 let j = i * 1000; |
| 33 closure_shared_state_test.f = dart.fn(x => { |
| 34 let q = j; |
| 35 j = x; |
| 36 return q; |
| 37 }, intToint()); |
| 38 closure_shared_state_test.g = dart.fn(x => { |
| 39 let q = j; |
| 40 j = x; |
| 41 return q; |
| 42 }, intToint()); |
| 43 } |
| 44 }; |
| 45 dart.fn(closure_shared_state_test.setupLoop, VoidTodynamic()); |
| 46 closure_shared_state_test.setupNestedLoop = function() { |
| 47 for (let outer = 0; outer < 2; outer++) { |
| 48 let j = outer * 1000; |
| 49 for (let i = 0; i < 2; i++) { |
| 50 closure_shared_state_test.f = dart.fn(x => { |
| 51 let q = j; |
| 52 j = x; |
| 53 return q; |
| 54 }, intToint()); |
| 55 closure_shared_state_test.g = dart.fn(x => { |
| 56 let q = j; |
| 57 j = x; |
| 58 return q; |
| 59 }, intToint()); |
| 60 } |
| 61 } |
| 62 }; |
| 63 dart.fn(closure_shared_state_test.setupNestedLoop, VoidTodynamic()); |
| 64 closure_shared_state_test.test = function(setup) { |
| 65 dart.dcall(setup); |
| 66 expect$.Expect.equals(1000, dart.dcall(closure_shared_state_test.f, 100)); |
| 67 expect$.Expect.equals(100, dart.dcall(closure_shared_state_test.f, 200)); |
| 68 expect$.Expect.equals(200, dart.dcall(closure_shared_state_test.f, 300)); |
| 69 expect$.Expect.equals(300, dart.dcall(closure_shared_state_test.g, 400)); |
| 70 expect$.Expect.equals(400, dart.dcall(closure_shared_state_test.g, 500)); |
| 71 }; |
| 72 dart.fn(closure_shared_state_test.test, dynamicTodynamic()); |
| 73 closure_shared_state_test.main = function() { |
| 74 closure_shared_state_test.test(closure_shared_state_test.setupPlain); |
| 75 closure_shared_state_test.test(closure_shared_state_test.setupLoop); |
| 76 closure_shared_state_test.test(closure_shared_state_test.setupNestedLoop); |
| 77 }; |
| 78 dart.fn(closure_shared_state_test.main, VoidTodynamic()); |
| 79 // Exports: |
| 80 exports.closure_shared_state_test = closure_shared_state_test; |
| 81 }); |
OLD | NEW |