| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, 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 comparison of this and a constant. | |
| 6 | |
| 7 class Foo { | |
| 8 static final C1 = const Foo('C1'); | |
| 9 static final C2 = const Foo('C2'); | |
| 10 static final C3 = const Foo('C3'); | |
| 11 | |
| 12 final name; | |
| 13 const Foo(this.name); | |
| 14 | |
| 15 foo() { | |
| 16 switch (this) { | |
| 17 case C1: return C1; | |
| 18 case C2: return C2; | |
| 19 default: return null; | |
| 20 } | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 main() { | |
| 25 Expect.equals(Foo.C1, Foo.C1.foo()); | |
| 26 Expect.equals(Foo.C2, Foo.C2.foo()); | |
| 27 Expect.equals(null, Foo.C3.foo()); | |
| 28 } | |
| OLD | NEW |