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

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

Issue 725293004: Add support for if, while, break, continue to js-cps (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Tests of control flow statements.
6
7 library control_flow_tests;
8
9 import 'js_backend_cps_ir_test.dart';
10
11 const List<TestEntry> tests = const [
12 const TestEntry("""
13 main() {
14 while (true);
15 }
16 """, """
17 function() {
18 while (true)
19 ;
20 }"""),
21 const TestEntry("""
22 foo(a) => a;
23
24 main() {
25 while (true) {
26 l: while (true) {
27 while (foo(true)) {
28 if (foo(false)) break l;
29 }
30 print(1);
31 }
32 print(2);
33 }
34 }
35 """, """
36 function() {
37 L0:
38 while (true)
39 while (true) {
40 while (P.identical(V.foo(true), true))
41 if (P.identical(V.foo(false), true)) {
42 P.print(2);
43 continue L0;
44 }
45 P.print(1);
46 }
47 }"""),
48 const TestEntry("""
49 foo(a) => a;
50
51 main() {
52 for (int i = 0; foo(true); i = foo(i)) {
53 print(1);
54 if (foo(false)) break;
55 }
56 print(2);
57 }""", """
58 function() {
59 var i;
60 i = 0;
61 L1:
62 while (true) {
63 if (P.identical(V.foo(true), true)) {
64 P.print(1);
65 if (!P.identical(V.foo(false), true)) {
66 i = V.foo(i);
67 continue L1;
68 }
69 }
70 P.print(2);
71 return null;
72 }
73 }"""),
74 const TestEntry("""
75 foo(a) => a;
76
77 main() {
78 if (foo(true)) {
79 print(1);
80 } else {
81 print(2);
82 }
83 print(3);
84 }""", """
85 function() {
86 P.identical(V.foo(true), true) ? P.print(1) : P.print(2);
87 P.print(3);
88 return null;
89 }"""),
90 const TestEntry("""
91 foo(a) => a;
92
93 main() {
94 if (foo(true)) {
95 print(1);
96 print(1);
97 } else {
98 print(2);
99 print(2);
100 }
101 print(3);
102 }""", """
103 function() {
104 if (P.identical(V.foo(true), true)) {
105 P.print(1);
106 P.print(1);
107 } else {
108 P.print(2);
109 P.print(2);
110 }
111 P.print(3);
112 return null;
113 }"""),
114 ];
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698