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

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

Issue 1220193003: dart2js cps: Fuse tear-off and call invocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.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 4
5 // Tests of closures. 5 // Tests of closures.
6 6
7 library closures_test; 7 library closures_test;
8 8
9 import 'js_backend_cps_ir.dart'; 9 import 'js_backend_cps_ir.dart';
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 b() => () => a(); 99 b() => () => a();
100 } 100 }
101 main() { 101 main() {
102 print(new A().b()()); 102 print(new A().b()());
103 } 103 }
104 """, 104 """,
105 r""" 105 r"""
106 function() { 106 function() {
107 return new V.A_b_closure(this); 107 return new V.A_b_closure(this);
108 }"""), 108 }"""),
109
110 const TestEntry("""
111 staticMethod(x) => x;
112 main(x) {
113 var tearOff = staticMethod;
114 print(tearOff(123));
115 }
116 """,
117 r"""
118 function(x) {
119 P.print(V.staticMethod(123));
120 }"""),
121
122 const TestEntry("""
123 class Foo {
124 instanceMethod(x) => x;
125 }
126 main(x) {
127 var tearOff = new Foo().instanceMethod;
128 print(tearOff(123));
129 }
130 """,
131 r"""
132 function(x) {
133 P.print(V.Foo$().instanceMethod$1(123));
134 }"""),
135
136 const TestEntry("""
137 class Foo {
138 instanceMethod(x) => x;
139 }
140 main(x) {
141 var tearOff = new Foo().instanceMethod;
142 print(tearOff(123));
143 print(tearOff(321));
144 }
145 """,
146 r"""
147 function(x) {
148 var v0 = V.Foo$();
149 P.print(v0.instanceMethod$1(123));
150 P.print(v0.instanceMethod$1(321));
151 }"""),
152
153 const TestEntry("""
154 class Foo {
155 get getter {
156 print('getter');
157 return (x) => x;
158 }
159 }
160 main(x) {
161 var notTearOff = new Foo().getter;
162 print(notTearOff(123));
163 print(notTearOff(321));
164 }
165 """,
166 r"""
167 function(x) {
168 var notTearOff = V.Foo$().get$getter();
169 P.print(notTearOff.call$1(123));
170 P.print(notTearOff.call$1(321));
171 }"""),
172
173 const TestEntry("""
174 class Foo {
175 get getter {
176 print('getter');
177 return (x) => x;
178 }
179 }
180 main(x) {
181 var notTearOff = new Foo().getter;
182 print(notTearOff(123));
183 }
184 """,
185 r"""
186 function(x) {
187 P.print(V.Foo$().getter$1(123));
188 }"""),
109 ]; 189 ];
110 190
111 void main() { 191 void main() {
112 runTests(tests); 192 runTests(tests);
113 } 193 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698