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

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

Issue 1562893002: dart2js cps: Generate increment and compound operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Also compound string concatenation Created 4 years, 11 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
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 closures. 5 // Tests of closures.
6 6
7 library closures_test; 7 library closures_test;
8 8
9 import 'js_backend_cps_ir.dart'; 9 import 'js_backend_cps_ir.dart';
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 var a = () => x; 99 var a = () => x;
100 x = x + 1; 100 x = x + 1;
101 print(a()); 101 print(a());
102 return a; 102 return a;
103 } 103 }
104 """, 104 """,
105 r""" 105 r"""
106 function() { 106 function() {
107 var _box_0 = {}, a = new V.main_closure(_box_0), v0; 107 var _box_0 = {}, a = new V.main_closure(_box_0), v0;
108 _box_0.x = 122; 108 _box_0.x = 122;
109 _box_0.x = _box_0.x + 1; 109 ++_box_0.x;
110 v0 = H.S(a.call$0()); 110 v0 = H.S(a.call$0());
111 if (typeof dartPrint == "function") 111 if (typeof dartPrint == "function")
112 dartPrint(v0); 112 dartPrint(v0);
113 else if (typeof console == "object" && typeof console.log != "undefined") 113 else if (typeof console == "object" && typeof console.log != "undefined")
114 console.log(v0); 114 console.log(v0);
115 else if (!(typeof window == "object")) { 115 else if (!(typeof window == "object")) {
116 if (!(typeof print == "function")) 116 if (!(typeof print == "function"))
117 throw "Unable to print message: " + String(v0); 117 throw "Unable to print message: " + String(v0);
118 print(v0); 118 print(v0);
119 } 119 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }; 154 };
155 x = x + 1; 155 x = x + 1;
156 print(a()()); 156 print(a()());
157 return a; 157 return a;
158 } 158 }
159 """, 159 """,
160 r""" 160 r"""
161 function() { 161 function() {
162 var _box_0 = {}, a = new V.main_closure(_box_0), v0; 162 var _box_0 = {}, a = new V.main_closure(_box_0), v0;
163 _box_0.x = 122; 163 _box_0.x = 122;
164 _box_0.x = _box_0.x + 1; 164 ++_box_0.x;
165 v0 = H.S(a.call$0().call$0()); 165 v0 = H.S(a.call$0().call$0());
166 if (typeof dartPrint == "function") 166 if (typeof dartPrint == "function")
167 dartPrint(v0); 167 dartPrint(v0);
168 else if (typeof console == "object" && typeof console.log != "undefined") 168 else if (typeof console == "object" && typeof console.log != "undefined")
169 console.log(v0); 169 console.log(v0);
170 else if (!(typeof window == "object")) { 170 else if (!(typeof window == "object")) {
171 if (!(typeof print == "function")) 171 if (!(typeof print == "function"))
172 throw "Unable to print message: " + String(v0); 172 throw "Unable to print message: " + String(v0);
173 print(v0); 173 print(v0);
174 } 174 }
175 return a; 175 return a;
176 }"""), 176 }"""),
177 177
178 const TestEntry(""" 178 const TestEntry("""
179 main() { 179 main() {
180 var a; 180 var a;
181 for (var i=0; i<10; i++) { 181 for (var i=0; i<10; i++) {
182 a = () => i; 182 a = () => i;
183 } 183 }
184 print(a()); 184 print(a());
185 } 185 }
186 """, 186 """,
187 r""" 187 r"""
188 function() { 188 function() {
189 var a = null, i = 0, v0; 189 var a = null, i = 0, v0;
190 for (; i < 10; a = new V.main_closure(i), i = i + 1) 190 for (; i < 10; a = new V.main_closure(i), ++i)
191 ; 191 ;
192 v0 = H.S(a.call$0()); 192 v0 = H.S(a.call$0());
193 if (typeof dartPrint == "function") 193 if (typeof dartPrint == "function")
194 dartPrint(v0); 194 dartPrint(v0);
195 else if (typeof console == "object" && typeof console.log != "undefined") 195 else if (typeof console == "object" && typeof console.log != "undefined")
196 console.log(v0); 196 console.log(v0);
197 else if (!(typeof window == "object")) { 197 else if (!(typeof window == "object")) {
198 if (!(typeof print == "function")) 198 if (!(typeof print == "function"))
199 throw "Unable to print message: " + String(v0); 199 throw "Unable to print message: " + String(v0);
200 print(v0); 200 print(v0);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 function(x) { 307 function(x) {
308 V.Foo$(); 308 V.Foo$();
309 P.print("getter"); 309 P.print("getter");
310 P.print(new V.Foo_getter_closure().call$1(123)); 310 P.print(new V.Foo_getter_closure().call$1(123));
311 }"""), 311 }"""),
312 ]; 312 ];
313 313
314 void main() { 314 void main() {
315 runTests(tests); 315 runTests(tests);
316 } 316 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_codeUnitAt_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698