OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/closure_in_constructor_test', null, /* Imports */
[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__closure_in_constructor_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_in_constructor_test = Object.create(null); |
| 11 let A = () => (A = dart.constFn(closure_in_constructor_test.A$()))(); |
| 12 let AOfint = () => (AOfint = dart.constFn(closure_in_constructor_test.A$(core.
int)))(); |
| 13 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 14 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 closure_in_constructor_test.A$ = dart.generic(T => { |
| 17 let AOfT = () => (AOfT = dart.constFn(closure_in_constructor_test.A$(T)))(); |
| 18 let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))(); |
| 19 let VoidToListOfT = () => (VoidToListOfT = dart.constFn(dart.definiteFunctio
nType(ListOfT(), [])))(); |
| 20 class A extends core.Object { |
| 21 static factory() { |
| 22 return new (AOfT())(dart.fn(() => ListOfT().new(), VoidToListOfT())); |
| 23 } |
| 24 new(closure) { |
| 25 if (closure === void 0) closure = null; |
| 26 this.closure = closure; |
| 27 if (this.closure == null) { |
| 28 this.closure = dart.fn(() => ListOfT().new(), VoidToListOfT()); |
| 29 } |
| 30 } |
| 31 } |
| 32 dart.addTypeTests(A); |
| 33 dart.setSignature(A, { |
| 34 constructors: () => ({ |
| 35 factory: dart.definiteFunctionType(closure_in_constructor_test.A$(T), []
), |
| 36 new: dart.definiteFunctionType(closure_in_constructor_test.A$(T), [], [d
art.dynamic]) |
| 37 }) |
| 38 }); |
| 39 return A; |
| 40 }); |
| 41 closure_in_constructor_test.A = A(); |
| 42 closure_in_constructor_test.main = function() { |
| 43 expect$.Expect.isTrue(core.List.is(dart.dsend(closure_in_constructor_test.A.
factory(), 'closure'))); |
| 44 expect$.Expect.isTrue(core.List.is(dart.dsend(new closure_in_constructor_tes
t.A(), 'closure'))); |
| 45 expect$.Expect.isTrue(ListOfint().is(dart.dsend(AOfint().factory(), 'closure
'))); |
| 46 expect$.Expect.isTrue(ListOfint().is(dart.dsend(new (AOfint())(), 'closure')
)); |
| 47 expect$.Expect.isFalse(ListOfString().is(dart.dsend(AOfint().factory(), 'clo
sure'))); |
| 48 expect$.Expect.isFalse(ListOfString().is(dart.dsend(new (AOfint())(), 'closu
re'))); |
| 49 }; |
| 50 dart.fn(closure_in_constructor_test.main, VoidTodynamic()); |
| 51 // Exports: |
| 52 exports.closure_in_constructor_test = closure_in_constructor_test; |
| 53 }); |
OLD | NEW |