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

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

Issue 861093002: Support intercepted getters, setters and index operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | 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, v0; 22 var g, v0;
23 g = 1; 23 g = 1;
24 v0 = 3; 24 v0 = 3;
25 P.print(J.getInterceptor(g).$add(g, v0)); 25 P.print(J.getInterceptor$ns(g).$add(g, v0));
26 return null; 26 return null;
27 }"""), 27 }"""),
28 const TestEntry("""
29 main() {
30 var l = ['hest', ['h', 'e', 's', 't']];
31 print(l.length);
32 for (int i = 0; i < l.length; i++) {
33 var x = l[i];
34 for (int j = 0; j < x.length; j++) {
35 print(x[j]);
36 }
37 }
38 }""",
39 r"""
40 function() {
41 var l, i, v0, x, j, v1, v2, v3;
42 l = ["hest", ["h", "e", "s", "t"]];
43 P.print(J.getInterceptor$as(l).get$length(l));
44 i = 0;
45 L0:
46 while (true) {
47 v0 = J.getInterceptor$as(l).get$length(l);
48 if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) {
49 x = J.getInterceptor$as(l).$index(l, i);
50 j = 0;
51 while (true) {
52 v1 = J.getInterceptor$as(x).get$length(x);
53 if (P.identical(J.getInterceptor$n(j).$lt(j, v1), true)) {
54 P.print(J.getInterceptor$as(x).$index(x, j));
55 v2 = 1;
56 j = J.getInterceptor$ns(j).$add(j, v2);
57 } else {
58 v3 = 1;
59 i = J.getInterceptor$ns(i).$add(i, v3);
60 continue L0;
61 }
62 }
63 } else
64 return null;
65 }
66 }"""),
28 ]; 67 ];
29 68
30 69
31 void main() { 70 void main() {
32 runTests(tests); 71 runTests(tests);
33 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698