OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/implicit_closure_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__implicit_closure_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 implicit_closure_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core
.int, [])))(); |
| 13 implicit_closure_test.First = class First extends core.Object { |
| 14 new(i) { |
| 15 this.i = i; |
| 16 this.b = null; |
| 17 } |
| 18 foo() { |
| 19 return this.i; |
| 20 } |
| 21 foo1() { |
| 22 const local = (function() { |
| 23 return this.i; |
| 24 }).bind(this); |
| 25 dart.fn(local, VoidTodynamic()); |
| 26 return local; |
| 27 } |
| 28 }; |
| 29 dart.setSignature(implicit_closure_test.First, { |
| 30 constructors: () => ({new: dart.definiteFunctionType(implicit_closure_test.F
irst, [core.int])}), |
| 31 methods: () => ({ |
| 32 foo: dart.definiteFunctionType(core.int, []), |
| 33 foo1: dart.definiteFunctionType(core.Function, []) |
| 34 }) |
| 35 }); |
| 36 implicit_closure_test.ImplicitClosureTest = class ImplicitClosureTest extends
core.Object { |
| 37 static testMain() { |
| 38 let obj = new implicit_closure_test.First(20); |
| 39 let func = dart.fn(() => obj.i, VoidToint()); |
| 40 obj.b = func; |
| 41 expect$.Expect.equals(20, dart.dsend(obj, 'b')); |
| 42 let ib1 = obj.foo1(); |
| 43 expect$.Expect.equals(obj.i, dart.dcall(ib1)); |
| 44 let ib = dart.bind(obj, 'foo'); |
| 45 expect$.Expect.equals(obj.i, ib()); |
| 46 } |
| 47 }; |
| 48 dart.setSignature(implicit_closure_test.ImplicitClosureTest, { |
| 49 statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), |
| 50 names: ['testMain'] |
| 51 }); |
| 52 implicit_closure_test.main = function() { |
| 53 implicit_closure_test.ImplicitClosureTest.testMain(); |
| 54 }; |
| 55 dart.fn(implicit_closure_test.main, VoidTodynamic()); |
| 56 // Exports: |
| 57 exports.implicit_closure_test = implicit_closure_test; |
| 58 }); |
OLD | NEW |