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

Side by Side Diff: tests/compiler/dart2js/js_backend_cps_ir_interceptors_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 of interceptors. 6 // Tests of interceptors.
7 7
8 library interceptors_tests; 8 library interceptors_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(""" 13 const TestEntry("""
14 main() { 14 main() {
15 var g = 1; 15 var g = 1;
16 16
17 var x = g + 3; 17 var x = g + 3;
18 print(x); 18 print(x);
19 }""", 19 }""",
20 r""" 20 r"""
21 function() { 21 function() {
22 var g; 22 var g = 1;
23 g = 1;
24 P.print(J.getInterceptor$ns(g).$add(g, 3)); 23 P.print(J.getInterceptor$ns(g).$add(g, 3));
25 return null; 24 return null;
26 }"""), 25 }"""),
27 const TestEntry(""" 26 const TestEntry("""
28 main() { 27 main() {
29 var l = ['hest', ['h', 'e', 's', 't']]; 28 var l = ['hest', ['h', 'e', 's', 't']];
30 print(l.length); 29 print(l.length);
31 for (int i = 0; i < l.length; i++) { 30 for (int i = 0; i < l.length; i++) {
32 var x = l[i]; 31 var x = l[i];
33 for (int j = 0; j < x.length; j++) { 32 for (int j = 0; j < x.length; j++) {
34 print(x[j]); 33 print(x[j]);
35 } 34 }
36 } 35 }
37 }""", 36 }""",
38 r""" 37 r"""
39 function() { 38 function() {
40 var l, i, v0, x, j; 39 var l = ["hest", ["h", "e", "s", "t"]], i, v0, x, j;
41 l = ["hest", ["h", "e", "s", "t"]];
42 P.print(J.getInterceptor$as(l).get$length(l)); 40 P.print(J.getInterceptor$as(l).get$length(l));
43 i = 0; 41 i = 0;
44 L0: 42 L0:
45 while (true) { 43 while (true) {
46 v0 = J.getInterceptor$as(l).get$length(l); 44 v0 = J.getInterceptor$as(l).get$length(l);
47 if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) { 45 if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) {
48 x = J.getInterceptor$as(l).$index(l, i); 46 x = J.getInterceptor$as(l).$index(l, i);
49 j = 0; 47 j = 0;
50 while (true) { 48 while (true) {
51 v0 = J.getInterceptor$as(x).get$length(x); 49 v0 = J.getInterceptor$as(x).get$length(x);
52 if (P.identical(J.getInterceptor$n(j).$lt(j, v0), true)) { 50 if (P.identical(J.getInterceptor$n(j).$lt(j, v0), true)) {
53 P.print(J.getInterceptor$as(x).$index(x, j)); 51 P.print(J.getInterceptor$as(x).$index(x, j));
54 j = J.getInterceptor$ns(j).$add(j, 1); 52 j = J.getInterceptor$ns(j).$add(j, 1);
55 } else { 53 } else {
56 i = J.getInterceptor$ns(i).$add(i, 1); 54 i = J.getInterceptor$ns(i).$add(i, 1);
57 continue L0; 55 continue L0;
58 } 56 }
59 } 57 }
60 } else 58 } else
61 return null; 59 return null;
62 } 60 }
63 }"""), 61 }"""),
64 ]; 62 ];
65 63
66 64
67 void main() { 65 void main() {
68 runTests(tests); 66 runTests(tests);
69 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698