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

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: Only reject instance members that need interceptors and disable a test that we do not support yet. Created 5 years, 10 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
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_interceptors_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Reenable when we support compiling functions that
34 class Base { 34 // need interceptor calling convention.
35 m(x) { 35 // const TestEntry.forMethod('function(Sub#+)', """
36 print(x+1000); 36 // class Base {
37 } 37 // m(x) {
38 operator+(x) => m(x+10); 38 // print(x+1000);
39 } 39 // }
40 class Sub extends Base { 40 // operator+(x) => m(x+10);
41 m(x) => super.m(x+100); 41 // }
42 operator+(x) => super + (x+1); 42 // class Sub extends Base {
43 } 43 // m(x) => super.m(x+100);
44 main() { 44 // operator+(x) => super + (x+1);
45 new Sub() + 10000; 45 // }
46 }""", 46 // main() {
47 r""" 47 // new Sub() + 10000;
48 function(x) { 48 // }""",
49 var v0, v1, v2; 49 // r"""
50 v0 = 1; 50 // function(x) {
51 v1 = J.getInterceptor(x).$add(x, v0); 51 // var v0, v1, v2;
52 v2 = this; 52 // v0 = 1;
53 return V.Base.prototype.$add.call(null, v2, v1); 53 // v1 = J.getInterceptor$ns(x).$add(x, v0);
54 }"""), 54 // v2 = this;
55 // return V.Base.prototype.$add.call(null, v2, v1);
56 // }"""),
55 57
56 const TestEntry.forMethod('function(Sub#m)', """ 58 const TestEntry.forMethod('function(Sub#m)', """
57 class Base { 59 class Base {
58 var field; 60 var field;
59 } 61 }
60 class Sub extends Base { 62 class Sub extends Base {
61 m(x) => x + super.field; 63 m(x) => x + super.field;
62 } 64 }
63 main() { 65 main() {
64 print(new Sub().m(10)); 66 print(new Sub().m(10));
65 }""", 67 }""",
66 r""" 68 r"""
67 function(x) { 69 function(x) {
68 var v0; 70 var v0;
69 v0 = this.field; 71 v0 = this.field;
70 return J.getInterceptor(x).$add(x, v0); 72 return J.getInterceptor$ns(x).$add(x, v0);
71 }"""), 73 }"""),
72 74
73 75
74 ]; 76 ];
75 77
76 void main() { 78 void main() {
77 runTests(tests); 79 runTests(tests);
78 } 80 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_interceptors_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698