OLD | NEW |
1 dart_library.library('methods', null, /* Imports */[ | 1 dart_library.library('methods', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart_sdk' |
3 'dart/core' | 3 ], function(exports, dart_sdk) { |
4 ], /* Lazy imports */[ | |
5 ], function(exports, dart, core) { | |
6 'use strict'; | 4 'use strict'; |
7 let dartx = dart.dartx; | 5 const core = dart_sdk.core; |
| 6 const dart = dart_sdk.dart; |
| 7 const dartx = dart_sdk.dartx; |
| 8 const methods = Object.create(null); |
8 const _c = Symbol('_c'); | 9 const _c = Symbol('_c'); |
9 class A extends core.Object { | 10 methods.A = class A extends core.Object { |
10 A() { | 11 A() { |
11 this[_c] = 3; | 12 this[_c] = 3; |
12 } | 13 } |
13 x() { | 14 x() { |
14 return 42; | 15 return 42; |
15 } | 16 } |
16 y(a) { | 17 y(a) { |
17 return a; | 18 return a; |
18 } | 19 } |
19 z(b) { | 20 z(b) { |
(...skipping 23 matching lines...) Expand all Loading... |
43 get a() { | 44 get a() { |
44 return this.x(); | 45 return this.x(); |
45 } | 46 } |
46 set b(b) {} | 47 set b(b) {} |
47 get c() { | 48 get c() { |
48 return this[_c]; | 49 return this[_c]; |
49 } | 50 } |
50 set c(c) { | 51 set c(c) { |
51 this[_c] = c; | 52 this[_c] = c; |
52 } | 53 } |
53 } | 54 }; |
54 dart.setSignature(A, { | 55 dart.setSignature(methods.A, { |
55 methods: () => ({ | 56 methods: () => ({ |
56 x: [core.int, []], | 57 x: [core.int, []], |
57 y: [core.int, [core.int]], | 58 y: [core.int, [core.int]], |
58 z: [core.int, [], [core.num]], | 59 z: [core.int, [], [core.num]], |
59 zz: [core.int, [], [core.int]], | 60 zz: [core.int, [], [core.int]], |
60 w: [core.int, [core.int], {b: core.num}], | 61 w: [core.int, [core.int], {b: core.num}], |
61 ww: [core.int, [core.int], {b: core.int}], | 62 ww: [core.int, [core.int], {b: core.int}], |
62 clashWithObjectProperty: [dart.dynamic, [], {constructor: dart.dynamic}], | 63 clashWithObjectProperty: [dart.dynamic, [], {constructor: dart.dynamic}], |
63 clashWithJsReservedName: [dart.dynamic, [], {function: dart.dynamic}] | 64 clashWithJsReservedName: [dart.dynamic, [], {function: dart.dynamic}] |
64 }) | 65 }) |
65 }); | 66 }); |
66 class Bar extends core.Object { | 67 methods.Bar = class Bar extends core.Object { |
67 call(x) { | 68 call(x) { |
68 return core.print(`hello from ${x}`); | 69 return core.print(`hello from ${x}`); |
69 } | 70 } |
70 } | 71 }; |
71 dart.setSignature(Bar, { | 72 dart.setSignature(methods.Bar, { |
72 methods: () => ({call: [dart.dynamic, [dart.dynamic]]}) | 73 methods: () => ({call: [dart.dynamic, [dart.dynamic]]}) |
73 }); | 74 }); |
74 class Foo extends core.Object { | 75 methods.Foo = class Foo extends core.Object { |
75 Foo() { | 76 Foo() { |
76 this.bar = new Bar(); | 77 this.bar = new methods.Bar(); |
77 } | 78 } |
78 } | 79 }; |
79 function test() { | 80 methods.test = function() { |
80 let f = new Foo(); | 81 let f = new methods.Foo(); |
81 dart.dcall(f.bar, "Bar's call method!"); | 82 dart.dcall(f.bar, "Bar's call method!"); |
82 let a = new A(); | 83 let a = new methods.A(); |
83 let g = dart.bind(a, 'x'); | 84 let g = dart.bind(a, 'x'); |
84 let aa = new A(); | 85 let aa = new methods.A(); |
85 let h = dart.dload(aa, 'x'); | 86 let h = dart.dload(aa, 'x'); |
86 let ts = dart.bind(a, 'toString'); | 87 let ts = dart.bind(a, 'toString'); |
87 let nsm = dart.bind(a, 'noSuchMethod'); | 88 let nsm = dart.bind(a, 'noSuchMethod'); |
88 let c = dart.bind("", dartx.padLeft); | 89 let c = dart.bind("", dartx.padLeft); |
89 let r = dart.bind(3.0, dartx.floor); | 90 let r = dart.bind(3.0, dartx.floor); |
90 } | 91 }; |
91 dart.fn(test); | 92 dart.fn(methods.test); |
92 // Exports: | 93 // Exports: |
93 exports.A = A; | 94 exports.methods = methods; |
94 exports.Bar = Bar; | |
95 exports.Foo = Foo; | |
96 exports.test = test; | |
97 }); | 95 }); |
OLD | NEW |