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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
77 testRedirectingFactoryInvoke(); | 84 testRedirectingFactoryInvoke(); |
78 testRedirectingFactoryInvokeGeneric(); | 85 testRedirectingFactoryInvokeGeneric(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 topLevelFunction1Typed(0); | 151 topLevelFunction1Typed(0); |
145 topLevelFunction2Typed('1'); | 152 topLevelFunction2Typed('1'); |
146 topLevelFunction2Typed('2', 3); | 153 topLevelFunction2Typed('2', 3); |
147 topLevelFunction2Typed('3', 5, 6.0); | 154 topLevelFunction2Typed('3', 5, 6.0); |
148 topLevelFunction3Typed(true); | 155 topLevelFunction3Typed(true); |
149 topLevelFunction3Typed(false, b: []); | 156 topLevelFunction3Typed(false, b: []); |
150 topLevelFunction3Typed(null, c: {}); | 157 topLevelFunction3Typed(null, c: {}); |
151 topLevelFunction3Typed(true, b: [13], c: {'14': true}); | 158 topLevelFunction3Typed(true, b: [13], c: {'14': true}); |
152 topLevelFunction3Typed(false, c: {'16': false}, b: [17]); | 159 topLevelFunction3Typed(false, c: {'16': false}, b: [17]); |
153 } | 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 |
154 var topLevelField; | 174 var topLevelField; |
155 testTopLevelField() => topLevelField; | 175 testTopLevelField() => topLevelField; |
156 int topLevelFieldTyped; | 176 int topLevelFieldTyped; |
157 testTopLevelFieldTyped() => topLevelFieldTyped; | 177 testTopLevelFieldTyped() => topLevelFieldTyped; |
158 testDynamicInvoke(o) { | 178 testDynamicInvoke(o) { |
159 o.f1(0); | 179 o.f1(0); |
160 o.f2(1); | 180 o.f2(1); |
161 o.f3(2, 3); | 181 o.f3(2, 3); |
162 o.f4(4, 5, 6); | 182 o.f4(4, 5, 6); |
163 o.f5(7); | 183 o.f5(7); |
164 o.f6(8, b: 9); | 184 o.f6(8, b: 9); |
165 o.f7(10, c: 11); | 185 o.f7(10, c: 11); |
166 o.f8(12, b: 13, c: 14); | 186 o.f8(12, b: 13, c: 14); |
167 o.f9(15, c: 16, b: 17); | 187 o.f9(15, c: 16, b: 17); |
168 } | 188 } |
169 testDynamicGet(o) => o.foo; | 189 testDynamicGet(o) => o.foo; |
170 testDynamicSet(o) => o.foo = 42; | 190 testDynamicSet(o) => o.foo = 42; |
| 191 testLocalWithoutInitializer() { |
| 192 var l; |
| 193 } |
171 testLocalWithInitializer() { | 194 testLocalWithInitializer() { |
172 var l = 42; | 195 var l = 42; |
173 } | 196 } |
| 197 testLocalWithInitializerTyped() { |
| 198 int l = 42; |
| 199 } |
174 testLocalFunction() { | 200 testLocalFunction() { |
175 localFunction() {} | 201 localFunction() {} |
176 } | 202 } |
| 203 testLocalFunctionTyped() { |
| 204 int localFunction(String a) => 42; |
| 205 } |
177 testLocalFunctionInvoke() { | 206 testLocalFunctionInvoke() { |
178 localFunction() {} | 207 localFunction() {} |
179 localFunction(); | 208 localFunction(); |
180 } | 209 } |
181 testLocalFunctionGet() { | 210 testLocalFunctionGet() { |
182 localFunction() {} | 211 localFunction() {} |
183 localFunction; | 212 localFunction; |
184 } | 213 } |
| 214 testClosure() { |
| 215 () {}; |
| 216 } |
| 217 testClosureInvoke() { |
| 218 () {} (); |
| 219 } |
185 testInvokeIndex(o) => o[42]; | 220 testInvokeIndex(o) => o[42]; |
186 testInvokeIndexSet(o) => o[42] = null; | 221 testInvokeIndexSet(o) => o[42] = null; |
187 testAssert() { | 222 testAssert() { |
188 assert(true); | 223 assert(true); |
189 } | 224 } |
190 testAssertWithMessage() { | 225 testAssertWithMessage() { |
191 assert(true, 'ok'); | 226 assert(true, 'ok'); |
192 } | 227 } |
193 testFactoryInvoke() { | 228 testFactoryInvoke() { |
194 new Class.fact(); | 229 new Class.fact(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // we cannot tell the diferrence. | 321 // we cannot tell the diferrence. |
287 builder.registerFeature(Feature.STRING_INTERPOLATION); | 322 builder.registerFeature(Feature.STRING_INTERPOLATION); |
288 builder.registerFeature(Feature.STRING_JUXTAPOSITION); | 323 builder.registerFeature(Feature.STRING_JUXTAPOSITION); |
289 break; | 324 break; |
290 default: | 325 default: |
291 } | 326 } |
292 } | 327 } |
293 impact.nativeData.forEach(builder.registerNativeData); | 328 impact.nativeData.forEach(builder.registerNativeData); |
294 return builder; | 329 return builder; |
295 } | 330 } |
OLD | NEW |