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

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

Issue 1088493002: Assignment expressions in tree IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments Created 5 years, 8 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
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 // VMOptions=-DUSE_CPS_IR=true 4 // VMOptions=-DUSE_CPS_IR=true
5 5
6 // Tests of closures. 6 // Tests of closures.
7 7
8 library closures_test; 8 library closures_test;
9 9
10 import 'js_backend_cps_ir.dart'; 10 import 'js_backend_cps_ir.dart';
11 11
12 const List<TestEntry> tests = const [ 12 const List<TestEntry> tests = const [
13 const TestEntry(""" 13 const TestEntry("""
14 main(x) { 14 main(x) {
15 a() { 15 a() {
16 return x; 16 return x;
17 } 17 }
18 x = x + '1'; 18 x = x + '1';
19 print(a()); 19 print(a());
20 } 20 }
21 """, 21 """,
22 r""" 22 r"""
23 function(x) { 23 function(x) {
24 var _box_0 = {}, a; 24 var _box_0 = {}, a;
25 _box_0._captured_x_0 = x; 25 _box_0._captured_x_0 = x;
26 a = new V.main_a(_box_0); 26 a = new V.main_a(_box_0);
27 x = _box_0._captured_x_0; 27 _box_0._captured_x_0 = J.getInterceptor$ns(x = _box_0._captured_x_0).$add(x, " 1");
28 _box_0._captured_x_0 = J.getInterceptor$ns(x).$add(x, "1");
29 P.print(a.call$0()); 28 P.print(a.call$0());
30 return null; 29 return null;
31 }"""), 30 }"""),
32 31
33 const TestEntry(""" 32 const TestEntry("""
34 main(x) { 33 main(x) {
35 a() { 34 a() {
36 return x; 35 return x;
37 } 36 }
38 print(a()); 37 print(a());
(...skipping 11 matching lines...) Expand all
50 var a = () => x; 49 var a = () => x;
51 x = x + 1; 50 x = x + 1;
52 print(a()); 51 print(a());
53 } 52 }
54 """, 53 """,
55 r""" 54 r"""
56 function() { 55 function() {
57 var _box_0 = {}, a, x; 56 var _box_0 = {}, a, x;
58 _box_0._captured_x_0 = 122; 57 _box_0._captured_x_0 = 122;
59 a = new V.main_closure(_box_0); 58 a = new V.main_closure(_box_0);
60 x = _box_0._captured_x_0; 59 _box_0._captured_x_0 = J.getInterceptor$ns(x = _box_0._captured_x_0).$add(x, 1 );
61 _box_0._captured_x_0 = J.getInterceptor$ns(x).$add(x, 1);
62 P.print(a.call$0()); 60 P.print(a.call$0());
63 return null; 61 return null;
64 }"""), 62 }"""),
65 63
66 const TestEntry(""" 64 const TestEntry("""
67 main() { 65 main() {
68 var x = 122; 66 var x = 122;
69 var a = () { 67 var a = () {
70 var y = x; 68 var y = x;
71 return () => y; 69 return () => y;
72 }; 70 };
73 x = x + 1; 71 x = x + 1;
74 print(a()()); 72 print(a()());
75 } 73 }
76 """, 74 """,
77 r""" 75 r"""
78 function() { 76 function() {
79 var _box_0 = {}, a, x; 77 var _box_0 = {}, a, x;
80 _box_0._captured_x_0 = 122; 78 _box_0._captured_x_0 = 122;
81 a = new V.main_closure(_box_0); 79 a = new V.main_closure(_box_0);
82 x = _box_0._captured_x_0; 80 _box_0._captured_x_0 = J.getInterceptor$ns(x = _box_0._captured_x_0).$add(x, 1 );
83 _box_0._captured_x_0 = J.getInterceptor$ns(x).$add(x, 1);
84 P.print(a.call$0().call$0()); 81 P.print(a.call$0().call$0());
85 return null; 82 return null;
86 }"""), 83 }"""),
87 84
88 const TestEntry(""" 85 const TestEntry("""
89 main() { 86 main() {
90 var a; 87 var a;
91 for (var i=0; i<10; i++) { 88 for (var i=0; i<10; i++) {
92 a = () => i; 89 a = () => i;
93 } 90 }
(...skipping 22 matching lines...) Expand all
116 """, 113 """,
117 r""" 114 r"""
118 function() { 115 function() {
119 return new V.A_b_closure(this); 116 return new V.A_b_closure(this);
120 }"""), 117 }"""),
121 ]; 118 ];
122 119
123 void main() { 120 void main() {
124 runTests(tests); 121 runTests(tests);
125 } 122 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698