OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 testLocalFunctionInvoke(); | 67 testLocalFunctionInvoke(); |
68 testLocalFunctionGet(); | 68 testLocalFunctionGet(); |
69 testInvokeIndex(null); | 69 testInvokeIndex(null); |
70 testInvokeIndexSet(null); | 70 testInvokeIndexSet(null); |
71 testAssert(); | 71 testAssert(); |
72 testAssertWithMessage(); | 72 testAssertWithMessage(); |
73 testFactoryInvoke(); | 73 testFactoryInvoke(); |
74 testFactoryInvokeGeneric(); | 74 testFactoryInvokeGeneric(); |
75 testFactoryInvokeGenericRaw(); | 75 testFactoryInvokeGenericRaw(); |
76 testFactoryInvokeGenericDynamic(); | 76 testFactoryInvokeGenericDynamic(); |
| 77 testRedirectingFactoryInvoke(); |
| 78 testRedirectingFactoryInvokeGeneric(); |
| 79 testRedirectingFactoryInvokeGenericRaw(); |
| 80 testRedirectingFactoryInvokeGenericDynamic(); |
77 } | 81 } |
78 | 82 |
79 testEmpty() {} | 83 testEmpty() {} |
80 testNull() => null; | 84 testNull() => null; |
81 testTrue() => true; | 85 testTrue() => true; |
82 testFalse() => false; | 86 testFalse() => false; |
83 testInt() => 42; | 87 testInt() => 42; |
84 testDouble() => 37.5; | 88 testDouble() => 37.5; |
85 testString() => 'foo'; | 89 testString() => 'foo'; |
86 testStringInterpolation() => '${0}'; | 90 testStringInterpolation() => '${0}'; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 195 } |
192 testFactoryInvokeGeneric() { | 196 testFactoryInvokeGeneric() { |
193 new GenericClass<int, String>.fact(); | 197 new GenericClass<int, String>.fact(); |
194 } | 198 } |
195 testFactoryInvokeGenericRaw() { | 199 testFactoryInvokeGenericRaw() { |
196 new GenericClass.fact(); | 200 new GenericClass.fact(); |
197 } | 201 } |
198 testFactoryInvokeGenericDynamic() { | 202 testFactoryInvokeGenericDynamic() { |
199 new GenericClass<dynamic, dynamic>.fact(); | 203 new GenericClass<dynamic, dynamic>.fact(); |
200 } | 204 } |
| 205 testRedirectingFactoryInvoke() { |
| 206 new Class.redirect(); |
| 207 } |
| 208 testRedirectingFactoryInvokeGeneric() { |
| 209 new GenericClass<int, String>.redirect(); |
| 210 } |
| 211 testRedirectingFactoryInvokeGenericRaw() { |
| 212 new GenericClass.redirect(); |
| 213 } |
| 214 testRedirectingFactoryInvokeGenericDynamic() { |
| 215 new GenericClass<dynamic, dynamic>.redirect(); |
| 216 } |
201 ''', | 217 ''', |
202 'helper.dart': ''' | 218 'helper.dart': ''' |
203 class Class { | 219 class Class { |
| 220 Class.generative(); |
204 factory Class.fact() => null; | 221 factory Class.fact() => null; |
| 222 factory Class.redirect() = Class.generative; |
205 } | 223 } |
206 class GenericClass<X, Y> { | 224 class GenericClass<X, Y> { |
| 225 GenericClass.generative(); |
207 factory GenericClass.fact() => null; | 226 factory GenericClass.fact() => null; |
| 227 factory GenericClass.redirect() = GenericClass.generative; |
208 } | 228 } |
209 ''', | 229 ''', |
210 }; | 230 }; |
211 | 231 |
212 main(List<String> args) { | 232 main(List<String> args) { |
213 asyncTest(() async { | 233 asyncTest(() async { |
214 enableDebugMode(); | 234 enableDebugMode(); |
215 Uri entryPoint = Uri.parse('memory:main.dart'); | 235 Uri entryPoint = Uri.parse('memory:main.dart'); |
216 Compiler compiler = compilerFor( | 236 Compiler compiler = compilerFor( |
217 entryPoint: entryPoint, | 237 entryPoint: entryPoint, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // we cannot tell the diferrence. | 286 // we cannot tell the diferrence. |
267 builder.registerFeature(Feature.STRING_INTERPOLATION); | 287 builder.registerFeature(Feature.STRING_INTERPOLATION); |
268 builder.registerFeature(Feature.STRING_JUXTAPOSITION); | 288 builder.registerFeature(Feature.STRING_JUXTAPOSITION); |
269 break; | 289 break; |
270 default: | 290 default: |
271 } | 291 } |
272 } | 292 } |
273 impact.nativeData.forEach(builder.registerNativeData); | 293 impact.nativeData.forEach(builder.registerNativeData); |
274 return builder; | 294 return builder; |
275 } | 295 } |
OLD | NEW |