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

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

Issue 11346002: Support argument definition test in constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « lib/compiler/implementation/ssa/codegen.dart ('k') | 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
(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 main() {
6 new Param.test1(false);
7 new Param.test1(true, 42);
8
9 new Param.test2(false);
10 new Param.test2(true, 42);
11
12 new Param.test3(false);
13 new Param.test3(true, 42);
14
15 new Param.test4();
16 new Param.test5();
17
18 new Param.test6(false);
19 new Param.test6(true, 42);
20
21 new Param.test7();
22 new Param.test8();
23 }
24
25 class Super {
26 var superField;
27 var otherSuperField;
28
29 Super();
30 Super.withParameters(passed, op, value) {
31 Expect.equals(passed, op);
32 Expect.equals(passed ? 42 : 0, value);
33 }
34
35 Super.withOptional(passed, [int a]) : superField = ?a {
36 Expect.equals(passed, ?a);
37 Expect.equals(passed, superField);
38 }
39
40 Super.withUpdate(passed, [int a = 0])
41 : superField = ?a, otherSuperField = a++ {
42 Expect.equals(passed, ?a);
43 Expect.equals(passed, superField);
44 Expect.equals(passed ? 43 : 1, a);
45 }
46 }
47
48 class Param extends Super {
49 var field;
50 var otherField;
51
52 Param.test1(a_check, [int a]) {
53 Expect.equals(a_check, ?a);
54 }
55
56 Param.test2(passed, [int a]) : field = ?a {
57 Expect.equals(passed, ?a);
58 Expect.equals(passed, field);
59 }
60
61 Param.test3(passed, [int a = 0]) : super.withParameters(passed, ?a, a) {
62 Expect.equals(passed, ?a);
63 }
64
65 Param.test4() : super.withOptional(true, 42);
66 Param.test5() : super.withOptional(false);
67
68 Param.test6(passed, [int a = 0]) : field = ?a, otherField = a++ {
69 Expect.equals(passed, ?a);
70 Expect.equals(passed, field);
71 Expect.equals(passed ? 43 : 1, a);
72 }
73
74 Param.test7() : super.withUpdate(true, 42);
75 Param.test8() : super.withUpdate(false);
76 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698