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

Side by Side Diff: tests/compiler/dart2js/kernel/impact_test.dart

Issue 2360773003: More kernel_impact. (Closed)
Patch Set: Updated cf. comments Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library dart2js.kernel.impact_test; 5 library dart2js.kernel.impact_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/commandline_options.dart'; 9 import 'package:compiler/src/commandline_options.dart';
10 import 'package:compiler/src/common.dart'; 10 import 'package:compiler/src/common.dart';
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 testUnaryMinus(); 50 testUnaryMinus();
51 testConditional(); 51 testConditional();
52 testPostInc(null); 52 testPostInc(null);
53 testPostDec(null); 53 testPostDec(null);
54 testPreInc(null); 54 testPreInc(null);
55 testPreDec(null); 55 testPreDec(null);
56 testIfThen(); 56 testIfThen();
57 testIfThenElse(); 57 testIfThenElse();
58 testTopLevelInvoke(); 58 testTopLevelInvoke();
59 testTopLevelInvokeTyped(); 59 testTopLevelInvokeTyped();
60 testTopLevelFunctionTyped();
61 testTopLevelFunctionGet();
60 testTopLevelField(); 62 testTopLevelField();
61 testTopLevelFieldTyped(); 63 testTopLevelFieldTyped();
62 testDynamicInvoke(null); 64 testDynamicInvoke(null);
63 testDynamicGet(null); 65 testDynamicGet(null);
64 testDynamicSet(null); 66 testDynamicSet(null);
67 testLocalWithoutInitializer();
65 testLocalWithInitializer(); 68 testLocalWithInitializer();
69 testLocalWithInitializerTyped();
66 testLocalFunction(); 70 testLocalFunction();
71 testLocalFunctionTyped();
67 testLocalFunctionInvoke(); 72 testLocalFunctionInvoke();
68 testLocalFunctionGet(); 73 testLocalFunctionGet();
74 testClosure();
75 testClosureInvoke();
69 testInvokeIndex(null); 76 testInvokeIndex(null);
70 testInvokeIndexSet(null); 77 testInvokeIndexSet(null);
71 testAssert(); 78 testAssert();
72 testAssertWithMessage(); 79 testAssertWithMessage();
73 testFactoryInvoke(); 80 testFactoryInvoke();
74 testFactoryInvokeGeneric(); 81 testFactoryInvokeGeneric();
75 testFactoryInvokeGenericRaw(); 82 testFactoryInvokeGenericRaw();
76 testFactoryInvokeGenericDynamic(); 83 testFactoryInvokeGenericDynamic();
84 testRedirectingFactoryInvoke();
85 testRedirectingFactoryInvokeGeneric();
86 testRedirectingFactoryInvokeGenericRaw();
87 testRedirectingFactoryInvokeGenericDynamic();
77 } 88 }
78 89
79 testEmpty() {} 90 testEmpty() {}
80 testNull() => null; 91 testNull() => null;
81 testTrue() => true; 92 testTrue() => true;
82 testFalse() => false; 93 testFalse() => false;
83 testInt() => 42; 94 testInt() => 42;
84 testDouble() => 37.5; 95 testDouble() => 37.5;
85 testString() => 'foo'; 96 testString() => 'foo';
86 testStringInterpolation() => '${0}'; 97 testStringInterpolation() => '${0}';
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 topLevelFunction1Typed(0); 151 topLevelFunction1Typed(0);
141 topLevelFunction2Typed('1'); 152 topLevelFunction2Typed('1');
142 topLevelFunction2Typed('2', 3); 153 topLevelFunction2Typed('2', 3);
143 topLevelFunction2Typed('3', 5, 6.0); 154 topLevelFunction2Typed('3', 5, 6.0);
144 topLevelFunction3Typed(true); 155 topLevelFunction3Typed(true);
145 topLevelFunction3Typed(false, b: []); 156 topLevelFunction3Typed(false, b: []);
146 topLevelFunction3Typed(null, c: {}); 157 topLevelFunction3Typed(null, c: {});
147 topLevelFunction3Typed(true, b: [13], c: {'14': true}); 158 topLevelFunction3Typed(true, b: [13], c: {'14': true});
148 topLevelFunction3Typed(false, c: {'16': false}, b: [17]); 159 topLevelFunction3Typed(false, c: {'16': false}, b: [17]);
149 } 160 }
161
162 topLevelFunctionTyped1(void a(num b)) {}
163 topLevelFunctionTyped2(void a(num b, [String c])) {}
164 topLevelFunctionTyped3(void a(num b, {String c, int d})) {}
165 topLevelFunctionTyped4(void a(num b, {String d, int c})) {}
166 testTopLevelFunctionTyped() {
167 topLevelFunctionTyped1(null);
168 topLevelFunctionTyped2(null);
169 topLevelFunctionTyped3(null);
170 topLevelFunctionTyped4(null);
171 }
172 testTopLevelFunctionGet() => topLevelFunction1;
173
150 var topLevelField; 174 var topLevelField;
151 testTopLevelField() => topLevelField; 175 testTopLevelField() => topLevelField;
152 int topLevelFieldTyped; 176 int topLevelFieldTyped;
153 testTopLevelFieldTyped() => topLevelFieldTyped; 177 testTopLevelFieldTyped() => topLevelFieldTyped;
154 testDynamicInvoke(o) { 178 testDynamicInvoke(o) {
155 o.f1(0); 179 o.f1(0);
156 o.f2(1); 180 o.f2(1);
157 o.f3(2, 3); 181 o.f3(2, 3);
158 o.f4(4, 5, 6); 182 o.f4(4, 5, 6);
159 o.f5(7); 183 o.f5(7);
160 o.f6(8, b: 9); 184 o.f6(8, b: 9);
161 o.f7(10, c: 11); 185 o.f7(10, c: 11);
162 o.f8(12, b: 13, c: 14); 186 o.f8(12, b: 13, c: 14);
163 o.f9(15, c: 16, b: 17); 187 o.f9(15, c: 16, b: 17);
164 } 188 }
165 testDynamicGet(o) => o.foo; 189 testDynamicGet(o) => o.foo;
166 testDynamicSet(o) => o.foo = 42; 190 testDynamicSet(o) => o.foo = 42;
191 testLocalWithoutInitializer() {
192 var l;
193 }
167 testLocalWithInitializer() { 194 testLocalWithInitializer() {
168 var l = 42; 195 var l = 42;
169 } 196 }
197 testLocalWithInitializerTyped() {
198 int l = 42;
199 }
170 testLocalFunction() { 200 testLocalFunction() {
171 localFunction() {} 201 localFunction() {}
172 } 202 }
203 testLocalFunctionTyped() {
204 int localFunction(String a) => 42;
205 }
173 testLocalFunctionInvoke() { 206 testLocalFunctionInvoke() {
174 localFunction() {} 207 localFunction() {}
175 localFunction(); 208 localFunction();
176 } 209 }
177 testLocalFunctionGet() { 210 testLocalFunctionGet() {
178 localFunction() {} 211 localFunction() {}
179 localFunction; 212 localFunction;
180 } 213 }
214 testClosure() {
215 () {};
216 }
217 testClosureInvoke() {
218 () {} ();
219 }
181 testInvokeIndex(o) => o[42]; 220 testInvokeIndex(o) => o[42];
182 testInvokeIndexSet(o) => o[42] = null; 221 testInvokeIndexSet(o) => o[42] = null;
183 testAssert() { 222 testAssert() {
184 assert(true); 223 assert(true);
185 } 224 }
186 testAssertWithMessage() { 225 testAssertWithMessage() {
187 assert(true, 'ok'); 226 assert(true, 'ok');
188 } 227 }
189 testFactoryInvoke() { 228 testFactoryInvoke() {
190 new Class.fact(); 229 new Class.fact();
191 } 230 }
192 testFactoryInvokeGeneric() { 231 testFactoryInvokeGeneric() {
193 new GenericClass<int, String>.fact(); 232 new GenericClass<int, String>.fact();
194 } 233 }
195 testFactoryInvokeGenericRaw() { 234 testFactoryInvokeGenericRaw() {
196 new GenericClass.fact(); 235 new GenericClass.fact();
197 } 236 }
198 testFactoryInvokeGenericDynamic() { 237 testFactoryInvokeGenericDynamic() {
199 new GenericClass<dynamic, dynamic>.fact(); 238 new GenericClass<dynamic, dynamic>.fact();
200 } 239 }
240 testRedirectingFactoryInvoke() {
241 new Class.redirect();
242 }
243 testRedirectingFactoryInvokeGeneric() {
244 new GenericClass<int, String>.redirect();
245 }
246 testRedirectingFactoryInvokeGenericRaw() {
247 new GenericClass.redirect();
248 }
249 testRedirectingFactoryInvokeGenericDynamic() {
250 new GenericClass<dynamic, dynamic>.redirect();
251 }
201 ''', 252 ''',
202 'helper.dart': ''' 253 'helper.dart': '''
203 class Class { 254 class Class {
255 Class.generative();
204 factory Class.fact() => null; 256 factory Class.fact() => null;
257 factory Class.redirect() = Class.generative;
205 } 258 }
206 class GenericClass<X, Y> { 259 class GenericClass<X, Y> {
260 GenericClass.generative();
207 factory GenericClass.fact() => null; 261 factory GenericClass.fact() => null;
262 factory GenericClass.redirect() = GenericClass.generative;
208 } 263 }
209 ''', 264 ''',
210 }; 265 };
211 266
212 main(List<String> args) { 267 main(List<String> args) {
213 asyncTest(() async { 268 asyncTest(() async {
214 enableDebugMode(); 269 enableDebugMode();
215 Uri entryPoint = Uri.parse('memory:main.dart'); 270 Uri entryPoint = Uri.parse('memory:main.dart');
216 Compiler compiler = compilerFor( 271 Compiler compiler = compilerFor(
217 entryPoint: entryPoint, 272 entryPoint: entryPoint,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // we cannot tell the diferrence. 321 // we cannot tell the diferrence.
267 builder.registerFeature(Feature.STRING_INTERPOLATION); 322 builder.registerFeature(Feature.STRING_INTERPOLATION);
268 builder.registerFeature(Feature.STRING_JUXTAPOSITION); 323 builder.registerFeature(Feature.STRING_JUXTAPOSITION);
269 break; 324 break;
270 default: 325 default:
271 } 326 }
272 } 327 }
273 impact.nativeData.forEach(builder.registerNativeData); 328 impact.nativeData.forEach(builder.registerNativeData);
274 return builder; 329 return builder;
275 } 330 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/feature.dart ('k') | tests/compiler/dart2js/kernel/visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698