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

Side by Side Diff: tests/compiler/dart2js/js_backend_cps_ir_operators_test.dart

Issue 1203423003: dart2js cps: Better fallthrough analysis and eliminate "return null". (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update tests Created 5 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
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_literals_test.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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // Tests of operators. 5 // Tests of operators.
6 6
7 library operators_tests; 7 library operators_tests;
8 8
9 import 'js_backend_cps_ir.dart'; 9 import 'js_backend_cps_ir.dart';
10 10
11 const List<TestEntry> tests = const [ 11 const List<TestEntry> tests = const [
12 const TestEntry("main() { return true ? 42 : 'foo'; }"), 12 const TestEntry("main() { return true ? 42 : 'foo'; }"),
13 const TestEntry(""" 13 const TestEntry("""
14 foo() => foo(); 14 foo() => foo();
15 main() { 15 main() {
16 print(foo() ? "hello world" : "bad bad"); 16 print(foo() ? "hello world" : "bad bad");
17 }""", 17 }""",
18 """function() { 18 """function() {
19 V.foo(); 19 V.foo();
20 P.print("bad bad"); 20 P.print("bad bad");
21 return null;
22 }"""), 21 }"""),
23 const TestEntry(""" 22 const TestEntry("""
24 foo() => null; 23 foo() => null;
25 main() { 24 main() {
26 print(foo() ? "hello world" : "bad bad"); 25 print(foo() ? "hello world" : "bad bad");
27 }""", 26 }""",
28 """function() { 27 """function() {
29 V.foo(); 28 V.foo();
30 P.print("bad bad"); 29 P.print("bad bad");
31 return null;
32 }"""), 30 }"""),
33 const TestEntry(""" 31 const TestEntry("""
34 get foo => foo; 32 get foo => foo;
35 main() { 33 main() {
36 print(foo ? "hello world" : "bad bad"); 34 print(foo ? "hello world" : "bad bad");
37 }""", 35 }""",
38 """function() { 36 """function() {
39 V.foo(); 37 V.foo();
40 P.print("bad bad"); 38 P.print("bad bad");
41 return null;
42 }"""), 39 }"""),
43 const TestEntry(""" 40 const TestEntry("""
44 get foo => foo; 41 get foo => foo;
45 main() { print(foo && foo); }""", 42 main() { print(foo && foo); }""",
46 """function() { 43 """function() {
47 V.foo(); 44 V.foo();
48 P.print(false); 45 P.print(false);
49 return null;
50 }"""), 46 }"""),
51 const TestEntry(""" 47 const TestEntry("""
52 get foo => foo; 48 get foo => foo;
53 main() { print(foo || foo); }""", 49 main() { print(foo || foo); }""",
54 """function() { 50 """function() {
55 V.foo(); 51 V.foo();
56 V.foo(); 52 V.foo();
57 P.print(false); 53 P.print(false);
58 return null;
59 }"""), 54 }"""),
60 55
61 // Needs interceptor calling convention 56 // Needs interceptor calling convention
62 //const TestEntry(""" 57 //const TestEntry("""
63 //class Foo { 58 //class Foo {
64 // operator[]=(index, value) { 59 // operator[]=(index, value) {
65 // print(value); 60 // print(value);
66 // } 61 // }
67 //} 62 //}
68 //main() { 63 //main() {
69 // var foo = new Foo(); 64 // var foo = new Foo();
70 // foo[5] = 6; 65 // foo[5] = 6;
71 //}""", r""" 66 //}""", r"""
72 //function() { 67 //function() {
73 // V.Foo$().$indexSet(5, 6); 68 // V.Foo$().$indexSet(5, 6);
74 //} 69 //}
75 //"""), 70 //"""),
76 71
77 const TestEntry(""" 72 const TestEntry("""
78 main() { 73 main() {
79 var list = [1, 2, 3]; 74 var list = [1, 2, 3];
80 list[1] = 6; 75 list[1] = 6;
81 print(list); 76 print(list);
82 }""", r""" 77 }""", r"""
83 function() { 78 function() {
84 var list = [1, 2, 3]; 79 var list = [1, 2, 3];
85 J.getInterceptor$a(list).$indexSet(list, 1, 6); 80 J.getInterceptor$a(list).$indexSet(list, 1, 6);
86 P.print(list); 81 P.print(list);
87 return null;
88 }"""), 82 }"""),
89 ]; 83 ];
90 84
91 void main() { 85 void main() {
92 runTests(tests); 86 runTests(tests);
93 } 87 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_literals_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698