| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 get index { |
| 6 print('called "index" getter'); |
| 7 return 0; |
| 8 } |
| 9 |
| 10 final _foo = new Foo(); |
| 11 get foo { |
| 12 print('called "foo" getter'); |
| 13 return _foo; |
| 14 } |
| 15 |
| 16 class Foo { int x = 100; } |
| 17 |
| 18 main() { |
| 19 var f = { 0: 40 }; |
| 20 print('should only call "index" 2 times:'); |
| 21 ++f[index]; |
| 22 forcePostfix(f[index]++); |
| 23 |
| 24 print('should only call "foo" 2 times:'); |
| 25 ++foo.x; |
| 26 forcePostfix(foo.x++); |
| 27 |
| 28 print('op assign test, should only call "index" twice:'); |
| 29 f[index] += f[index]; |
| 30 } |
| 31 |
| 32 // Postfix generates as prefix if the value isn't used. This method prevents it. |
| 33 forcePostfix(x) {} |
| OLD | NEW |