OLD | NEW |
| (Empty) |
1 dart_library.library('methods', null, /* Imports */[ | |
2 'dart_sdk' | |
3 ], function(exports, dart_sdk) { | |
4 'use strict'; | |
5 const core = dart_sdk.core; | |
6 const dart = dart_sdk.dart; | |
7 const dartx = dart_sdk.dartx; | |
8 const methods = Object.create(null); | |
9 const _c = Symbol('_c'); | |
10 methods.A = class A extends core.Object { | |
11 new() { | |
12 this[_c] = 3; | |
13 } | |
14 x() { | |
15 return 42; | |
16 } | |
17 y(a) { | |
18 return a; | |
19 } | |
20 z(b) { | |
21 if (b === void 0) b = null; | |
22 return dart.asInt(b); | |
23 } | |
24 zz(b) { | |
25 if (b === void 0) b = 0; | |
26 return b; | |
27 } | |
28 w(a, opts) { | |
29 let b = opts && 'b' in opts ? opts.b : null; | |
30 return dart.asInt(dart.notNull(a) + dart.notNull(b)); | |
31 } | |
32 ww(a, opts) { | |
33 let b = opts && 'b' in opts ? opts.b : 0; | |
34 return dart.notNull(a) + dart.notNull(b); | |
35 } | |
36 clashWithObjectProperty(opts) { | |
37 let constructor = opts && 'constructor' in opts ? opts.constructor : null; | |
38 return constructor; | |
39 } | |
40 clashWithJsReservedName(opts) { | |
41 let func = opts && 'function' in opts ? opts.function : null; | |
42 return func; | |
43 } | |
44 get a() { | |
45 return this.x(); | |
46 } | |
47 set b(b) {} | |
48 get c() { | |
49 return this[_c]; | |
50 } | |
51 set c(c) { | |
52 this[_c] = c; | |
53 } | |
54 }; | |
55 dart.setSignature(methods.A, { | |
56 methods: () => ({ | |
57 x: [core.int, []], | |
58 y: [core.int, [core.int]], | |
59 z: [core.int, [], [core.num]], | |
60 zz: [core.int, [], [core.int]], | |
61 w: [core.int, [core.int], {b: core.num}], | |
62 ww: [core.int, [core.int], {b: core.int}], | |
63 clashWithObjectProperty: [dart.dynamic, [], {constructor: dart.dynamic}], | |
64 clashWithJsReservedName: [dart.dynamic, [], {function: dart.dynamic}] | |
65 }) | |
66 }); | |
67 methods.Bar = class Bar extends core.Object { | |
68 call(x) { | |
69 return core.print(`hello from ${x}`); | |
70 } | |
71 }; | |
72 dart.setSignature(methods.Bar, { | |
73 methods: () => ({call: [dart.dynamic, [dart.dynamic]]}) | |
74 }); | |
75 methods.Foo = class Foo extends core.Object { | |
76 new() { | |
77 this.bar = new methods.Bar(); | |
78 } | |
79 }; | |
80 methods.test = function() { | |
81 let f = new methods.Foo(); | |
82 dart.dsend(f, 'bar', "Bar's call method!"); | |
83 let a = new methods.A(); | |
84 let g = dart.bind(a, 'x'); | |
85 let aa = new methods.A(); | |
86 let h = dart.dload(aa, 'x'); | |
87 let ts = dart.bind(a, 'toString'); | |
88 let nsm = dart.bind(a, 'noSuchMethod'); | |
89 let c = dart.bind("", dartx.padLeft); | |
90 let r = dart.bind(3.0, dartx.floor); | |
91 }; | |
92 dart.fn(methods.test); | |
93 // Exports: | |
94 exports.methods = methods; | |
95 }); | |
OLD | NEW |