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

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

Issue 1075113003: Pull JS assignments into var initializer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated js_cps_ir_backend test files 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 for basic functionality. 6 // Tests for basic functionality.
7 7
8 library basic_tests; 8 library basic_tests;
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(r""" 13 const TestEntry(r"""
14 main() { 14 main() {
15 var e = 1; 15 var e = 1;
16 var l = [1, 2, 3]; 16 var l = [1, 2, 3];
17 var m = {'s': 1}; 17 var m = {'s': 1};
18 18
19 print('(' ')'); 19 print('(' ')');
20 print('(${true})'); 20 print('(${true})');
21 print('(${1})'); 21 print('(${1})');
22 print('(${[1, 2, 3]})'); 22 print('(${[1, 2, 3]})');
23 print('(${{'s': 1}})'); 23 print('(${{'s': 1}})');
24 print('($e)'); 24 print('($e)');
25 print('($l)'); 25 print('($l)');
26 print('($m)'); 26 print('($m)');
27 }""",r""" 27 }""",r"""
28 function() { 28 function() {
29 var l, m; 29 var l = [1, 2, 3], m = P.LinkedHashMap_LinkedHashMap$_literal(["s", 1]);
30 l = [1, 2, 3];
31 m = P.LinkedHashMap_LinkedHashMap$_literal(["s", 1]);
32 P.print("()"); 30 P.print("()");
33 P.print("(" + true + ")"); 31 P.print("(" + true + ")");
34 P.print("(" + 1 + ")"); 32 P.print("(" + 1 + ")");
35 P.print("(" + H.S([1, 2, 3]) + ")"); 33 P.print("(" + H.S([1, 2, 3]) + ")");
36 P.print("(" + H.S(P.LinkedHashMap_LinkedHashMap$_literal(["s", 1])) + ")"); 34 P.print("(" + H.S(P.LinkedHashMap_LinkedHashMap$_literal(["s", 1])) + ")");
37 P.print("(" + 1 + ")"); 35 P.print("(" + 1 + ")");
38 P.print("(" + H.S(l) + ")"); 36 P.print("(" + H.S(l) + ")");
39 P.print("(" + H.S(m) + ")"); 37 P.print("(" + H.S(m) + ")");
40 return null; 38 return null;
41 }"""), 39 }"""),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 a = b; 72 a = b;
75 b = t; 73 b = t;
76 print(a); 74 print(a);
77 print(b); 75 print(b);
78 print(b); 76 print(b);
79 print(foo(a)); 77 print(foo(a));
80 } 78 }
81 """, 79 """,
82 """ 80 """
83 function() { 81 function() {
84 var a, b; 82 var a = 10, b = 1;
85 a = 10;
86 b = 1;
87 P.print(b); 83 P.print(b);
88 P.print(a); 84 P.print(a);
89 P.print(a); 85 P.print(a);
90 P.print(V.foo(b)); 86 P.print(V.foo(b));
91 return null; 87 return null;
92 }"""), 88 }"""),
93 const TestEntry( 89 const TestEntry(
94 """ 90 """
95 foo() { return 42; } 91 foo() { return 42; }
96 main() { return foo(); } 92 main() { return foo(); }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 function() { 151 function() {
156 V.foo(); 152 V.foo();
157 return null; 153 return null;
158 }"""), 154 }"""),
159 // Static setters 155 // Static setters
160 const TestEntry(""" 156 const TestEntry("""
161 var foo = 0; 157 var foo = 0;
162 main() { print(foo = 42); } 158 main() { print(foo = 42); }
163 """, r""" 159 """, r"""
164 function() { 160 function() {
165 var v0; 161 var v0 = 42;
166 v0 = 42;
167 $.foo = v0; 162 $.foo = v0;
168 P.print(v0); 163 P.print(v0);
169 return null; 164 return null;
170 }"""), 165 }"""),
171 const TestEntry(""" 166 const TestEntry("""
172 set foo(x) { print(x); } 167 set foo(x) { print(x); }
173 main() { foo = 42; } 168 main() { foo = 42; }
174 """, r""" 169 """, r"""
175 function() { 170 function() {
176 V.foo(42); 171 V.foo(42);
177 return null; 172 return null;
178 }""") 173 }""")
179 ]; 174 ];
180 175
181 176
182 void main() { 177 void main() {
183 runTests(tests); 178 runTests(tests);
184 } 179 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698