Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: tests/language/switch_this_test.dart

Issue 10446011: Make field final in const class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test comparison of this and a constant. 5 // Test comparison of this and a constant.
6 6
7 class Foo { 7 class Foo {
8 static final C1 = const Foo('C1'); 8 static final C1 = const Foo('C1');
9 static final C2 = const Foo('C2'); 9 static final C2 = const Foo('C2');
10 static final C3 = const Foo('C3'); 10 static final C3 = const Foo('C3');
11 11
12 var name; 12 final name;
13 const Foo(this.name); 13 const Foo(this.name);
14 14
15 foo() { 15 foo() {
16 switch (this) { 16 switch (this) {
17 case C1: return C1; 17 case C1: return C1;
18 case C2: return C2; 18 case C2: return C2;
19 default: return null; 19 default: return null;
20 } 20 }
21 } 21 }
22 } 22 }
23 23
24 main() { 24 main() {
25 Expect.equals(Foo.C1, Foo.C1.foo()); 25 Expect.equals(Foo.C1, Foo.C1.foo());
26 Expect.equals(Foo.C2, Foo.C2.foo()); 26 Expect.equals(Foo.C2, Foo.C2.foo());
27 Expect.equals(null, Foo.C3.foo()); 27 Expect.equals(null, Foo.C3.foo());
28 } 28 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698