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

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

Issue 10825386: Use JavaScript runtime semantics when constant folding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 3 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 | « tests/corelib/expression_test.dart ('k') | tests/language/canonical_const2_test.dart » ('j') | 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 test1(bool passed, [a = 42]) { 5 test1(bool passed, [a = 42]) {
6 if (passed) { 6 if (passed) {
7 Expect.equals(54, a); 7 Expect.equals(54, a);
8 Expect.isTrue(?a); 8 Expect.isTrue(?a);
9 } else { 9 } else {
10 Expect.equals(42, a); 10 Expect.equals(42, a);
(...skipping 23 matching lines...) Expand all
34 Expect.equals(54, a); 34 Expect.equals(54, a);
35 Expect.isTrue(?a); 35 Expect.isTrue(?a);
36 } else { 36 } else {
37 Expect.equals(42, a); 37 Expect.equals(42, a);
38 Expect.isFalse(?a); 38 Expect.isFalse(?a);
39 } 39 }
40 Expect.isTrue(?passed); 40 Expect.isTrue(?passed);
41 } 41 }
42 } 42 }
43 43
44
45 test4(bool passed, [a]) {
46 if (passed) {
47 Expect.equals(54, a);
48 Expect.isTrue(?a);
49 } else {
50 Expect.equals(null, a);
51 Expect.isFalse(?a);
52 }
53 Expect.isTrue(?passed);
54 }
55
44 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); 56 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
45 57
46 main() { 58 main() {
47 test1(true, 54); 59 test1(true, 54);
48 test1(false); 60 test1(false);
49 test2(); 61 test2();
50 new A().test3(true, 54); 62 new A().test3(true, 54);
51 new A().test3(false); 63 new A().test3(false);
52 64
53 var things = [test1, test2, new A().test3]; 65 var things = [test1, test2, new A().test3];
54 66
55 var closure = things[inscrutable(0)]; 67 var closure = things[inscrutable(0)];
56 closure(true, 54); 68 closure(true, 54);
57 closure(false); 69 closure(false);
58 70
59 closure = things[inscrutable(1)]; 71 closure = things[inscrutable(1)];
60 closure(); 72 closure();
61 73
62 closure = things[inscrutable(2)]; 74 closure = things[inscrutable(2)];
63 closure(true, 54); 75 closure(true, 54);
64 closure(false); 76 closure(false);
77
78 test4(true, 54);
79 test4(false);
65 } 80 }
OLDNEW
« no previous file with comments | « tests/corelib/expression_test.dart ('k') | tests/language/canonical_const2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698