OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/closure_self_reference_test', null, /* Imports */
[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__closure_self_reference_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_self_reference_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 closure_self_reference_test.main = function() { |
| 14 let counter = 0; |
| 15 function inner(value) { |
| 16 if (dart.equals(value, 0)) return 0; |
| 17 try { |
| 18 return inner(dart.dsend(value, '-', 1)); |
| 19 } finally { |
| 20 counter++; |
| 21 } |
| 22 } |
| 23 dart.fn(inner, dynamicTodynamic()); |
| 24 expect$.Expect.equals(0, inner(199)); |
| 25 expect$.Expect.equals(199, counter); |
| 26 }; |
| 27 dart.fn(closure_self_reference_test.main, VoidTodynamic()); |
| 28 // Exports: |
| 29 exports.closure_self_reference_test = closure_self_reference_test; |
| 30 }); |
OLD | NEW |