| OLD | NEW |
| (Empty) | |
| 1 var opassign; |
| 2 (function(exports) { |
| 3 'use strict'; |
| 4 dart.copyProperties(exports, { |
| 5 get index() { |
| 6 core.print('called "index" getter'); |
| 7 return 0; |
| 8 } |
| 9 }); |
| 10 dart.defineLazyProperties(exports, { |
| 11 get _foo() { |
| 12 return new Foo(); |
| 13 } |
| 14 }); |
| 15 dart.copyProperties(exports, { |
| 16 get foo() { |
| 17 core.print('called "foo" getter'); |
| 18 return exports._foo; |
| 19 } |
| 20 }); |
| 21 class Foo extends core.Object { |
| 22 Foo() { |
| 23 this.x = 100; |
| 24 } |
| 25 } |
| 26 // Function main: () → dynamic |
| 27 function main() { |
| 28 let f = dart.map([0, 40]); |
| 29 core.print('should only call "index" 2 times:'); |
| 30 let i = exports.index; |
| 31 f.set(i, dart.dbinary(f.get(i), '+', 1)); |
| 32 forcePostfix(((i, x$) => f.set(i, dart.dbinary(x$, '+', 1)), x$)(exports.ind
ex, f.get(i))); |
| 33 core.print('should only call "foo" 2 times:'); |
| 34 let o = exports.foo; |
| 35 dart.dput(o, 'x', dart.dbinary(dart.dload(o, 'x'), '+', 1)); |
| 36 forcePostfix(((o, x$) => dart.dput(o, 'x', dart.dbinary(x$, '+', 1)), x$)(ex
ports.foo, dart.dload(o, 'x'))); |
| 37 core.print('op assign test, should only call "index" twice:'); |
| 38 let i = exports.index; |
| 39 f.set(i, dart.dbinary(f.get(i), '+', f.get(exports.index))); |
| 40 } |
| 41 // Function forcePostfix: (dynamic) → dynamic |
| 42 function forcePostfix(x) { |
| 43 } |
| 44 // Exports: |
| 45 exports.Foo = Foo; |
| 46 exports.main = main; |
| 47 exports.forcePostfix = forcePostfix; |
| 48 })(opassign || (opassign = {})); |
| OLD | NEW |