OLD | NEW |
1 var opassign; | 1 var opassign; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 dart.copyProperties(exports, { | 4 dart.copyProperties(exports, { |
5 get index() { | 5 get index() { |
6 core.print('called "index" getter'); | 6 core.print('called "index" getter'); |
7 return 0; | 7 return 0; |
8 } | 8 } |
9 }); | 9 }); |
10 dart.defineLazyProperties(exports, { | 10 dart.defineLazyProperties(exports, { |
11 get _foo() { | 11 get _foo() { |
12 return new Foo(); | 12 return new Foo(); |
13 } | 13 } |
14 }); | 14 }); |
15 dart.copyProperties(exports, { | 15 dart.copyProperties(exports, { |
16 get foo() { | 16 get foo() { |
17 core.print('called "foo" getter'); | 17 core.print('called "foo" getter'); |
18 return exports._foo; | 18 return exports._foo; |
19 } | 19 } |
20 }); | 20 }); |
| 21 let x = Symbol('x'); |
21 class Foo extends core.Object { | 22 class Foo extends core.Object { |
22 Foo() { | 23 Foo() { |
23 this.x = 100; | 24 this[x] = 100; |
| 25 } |
| 26 get x() { |
| 27 return this[x]; |
| 28 } |
| 29 set x(value) { |
| 30 this[x] = value; |
24 } | 31 } |
25 } | 32 } |
26 // Function main: () → dynamic | 33 // Function main: () → dynamic |
27 function main() { | 34 function main() { |
28 let f = dart.map([0, 40]); | 35 let f = dart.map([0, 40]); |
29 core.print('should only call "index" 2 times:'); | 36 core.print('should only call "index" 2 times:'); |
30 let i = exports.index; | 37 let i = exports.index; |
31 f.set(i, dart.dsend(f.get(i), '+', 1)); | 38 f.set(i, dart.dsend(f.get(i), '+', 1)); |
32 forcePostfix((() => { | 39 forcePostfix((() => { |
33 let i = exports.index, x = f.get(i); | 40 let i = exports.index, x = f.get(i); |
(...skipping 13 matching lines...) Expand all Loading... |
47 f.set(i$, dart.dsend(f.get(i$), '+', f.get(exports.index))); | 54 f.set(i$, dart.dsend(f.get(i$), '+', f.get(exports.index))); |
48 } | 55 } |
49 // Function forcePostfix: (dynamic) → dynamic | 56 // Function forcePostfix: (dynamic) → dynamic |
50 function forcePostfix(x) { | 57 function forcePostfix(x) { |
51 } | 58 } |
52 // Exports: | 59 // Exports: |
53 exports.Foo = Foo; | 60 exports.Foo = Foo; |
54 exports.main = main; | 61 exports.main = main; |
55 exports.forcePostfix = forcePostfix; | 62 exports.forcePostfix = forcePostfix; |
56 })(opassign || (opassign = {})); | 63 })(opassign || (opassign = {})); |
OLD | NEW |