| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, 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 // Test for unresolved super[] and super[]= and correct evaluation order. |
| 6 |
| 7 import "package:expect/expect.dart"; |
| 8 |
| 9 class A { |
| 10 var indexField = new List(2); |
| 11 |
| 12 noSuchMethod(Invocation im) { |
| 13 if (im.memberName == const Symbol('[]=')) { |
| 14 Expect.equals(2, im.positionalArguments.length); |
| 15 indexField[im.positionalArguments[0]] = im.positionalArguments[1]; |
| 16 } else if (im.memberName == const Symbol('[]')) { |
| 17 Expect.equals(1, im.positionalArguments.length); |
| 18 return indexField[im.positionalArguments[0]]; |
| 19 } else { |
| 20 Expect.fail('Should not reach here'); |
| 21 } |
| 22 } |
| 23 } |
| 24 |
| 25 var global = 0; |
| 26 |
| 27 f() { |
| 28 Expect.equals(0, global++); |
| 29 return 0; |
| 30 } |
| 31 |
| 32 g() { |
| 33 Expect.equals(1, global++); |
| 34 return 42; |
| 35 } |
| 36 |
| 37 class B extends A { |
| 38 test() { |
| 39 Expect.equals(42, super[f()] = g()); |
| 40 Expect.equals(2, global); |
| 41 } |
| 42 } |
| 43 |
| 44 main() { |
| 45 new B().test(); |
| 46 } |
| OLD | NEW |