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

Side by Side Diff: tests/compiler/dart2js/js_backend_cps_ir_supercall_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 supercall_test; 8 library supercall_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.forMethod('function(Sub#m)', """ 13 const TestEntry.forMethod('function(Sub#m)', """
14 class Base { 14 class Base {
15 m(x) { 15 m(x) {
16 print(x+1); 16 print(x+1);
17 } 17 }
18 } 18 }
19 class Sub extends Base { 19 class Sub extends Base {
20 m(x) => super.m(x+10); 20 m(x) => super.m(x+10);
21 } 21 }
22 main() { 22 main() {
23 new Sub().m(100); 23 new Sub().m(100);
24 }""", 24 }""",
25 r""" 25 r"""
26 function(x) { 26 function(x) {
27 var v0, v1; 27 var v0, v1;
28 v0 = 10; 28 v0 = 10;
29 v1 = J.getInterceptor(x).$add(x, v0); 29 v1 = J.getInterceptor$ns(x).$add(x, v0);
30 return V.Base.prototype.m$1.call(this, v1); 30 return V.Base.prototype.m$1.call(this, v1);
31 }"""), 31 }"""),
32 32
33 const TestEntry.forMethod('function(Sub#+)', """ 33 const TestEntry.forMethod('function(Sub#+)', """
34 class Base { 34 class Base {
35 m(x) { 35 m(x) {
36 print(x+1000); 36 print(x+1000);
37 } 37 }
38 operator+(x) => m(x+10); 38 operator+(x) => m(x+10);
39 } 39 }
40 class Sub extends Base { 40 class Sub extends Base {
41 m(x) => super.m(x+100); 41 m(x) => super.m(x+100);
42 operator+(x) => super + (x+1); 42 operator+(x) => super + (x+1);
43 } 43 }
44 main() { 44 main() {
45 new Sub() + 10000; 45 new Sub() + 10000;
46 }""", 46 }""",
47 r""" 47 r"""
48 function(x) { 48 function(x) {
49 var v0, v1, v2; 49 var v0, v1, v2;
50 v0 = 1; 50 v0 = 1;
51 v1 = J.getInterceptor(x).$add(x, v0); 51 v1 = J.getInterceptor$ns(x).$add(x, v0);
52 v2 = this; 52 v2 = this;
53 return V.Base.prototype.$add.call(null, v2, v1); 53 return V.Base.prototype.$add.call(null, v2, v1);
54 }"""), 54 }"""),
55 55
56 const TestEntry.forMethod('function(Sub#m)', """ 56 const TestEntry.forMethod('function(Sub#m)', """
57 class Base { 57 class Base {
58 var field; 58 var field;
59 } 59 }
60 class Sub extends Base { 60 class Sub extends Base {
61 m(x) => x + super.field; 61 m(x) => x + super.field;
62 } 62 }
63 main() { 63 main() {
64 print(new Sub().m(10)); 64 print(new Sub().m(10));
65 }""", 65 }""",
66 r""" 66 r"""
67 function(x) { 67 function(x) {
68 var v0; 68 var v0;
69 v0 = this.field; 69 v0 = this.field;
70 return J.getInterceptor(x).$add(x, v0); 70 return J.getInterceptor$ns(x).$add(x, v0);
71 }"""), 71 }"""),
72 72
73 73
74 ]; 74 ];
75 75
76 void main() { 76 void main() {
77 runTests(tests); 77 runTests(tests);
78 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698