| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, 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 // Operator dart test program. | |
| 5 | |
| 6 class Helper { | |
| 7 int i; | |
| 8 Helper(int val) : i = val { } | |
| 9 operator [](int index) { | |
| 10 return i + index; | |
| 11 } | |
| 12 void operator []=(int index, int val) { | |
| 13 i = val; | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 class OperatorTest { | |
| 18 static testMain() { | |
| 19 Helper obj = new Helper(10); | |
| 20 Expect.equals(10, obj.i); | |
| 21 obj[10] = 20; | |
| 22 Expect.equals(30, obj[10]); | |
| 23 } | |
| 24 } | |
| 25 | |
| 26 | |
| 27 main() { | |
| 28 OperatorTest.testMain(); | |
| 29 } | |
| OLD | NEW |