| 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 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:compiler/src/commandline_options.dart'; | 8 import 'package:compiler/src/commandline_options.dart'; |
| 9 import 'package:compiler/src/common.dart'; | 9 import 'package:compiler/src/common.dart'; |
| 10 import 'package:compiler/src/common/names.dart'; | 10 import 'package:compiler/src/common/names.dart'; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 testForwardingConstructorGeneric(); | 177 testForwardingConstructorGeneric(); |
| 178 testEnum(); | 178 testEnum(); |
| 179 testStaticGenericMethod(); | 179 testStaticGenericMethod(); |
| 180 testInstanceGenericMethod(); | 180 testInstanceGenericMethod(); |
| 181 testDynamicPrivateMethodInvoke(); | 181 testDynamicPrivateMethodInvoke(); |
| 182 testJSCall(); | 182 testJSCall(); |
| 183 testNativeMethod(); | 183 testNativeMethod(); |
| 184 testNativeMethodCreates(); | 184 testNativeMethodCreates(); |
| 185 testNativeMethodReturns(); | 185 testNativeMethodReturns(); |
| 186 testNativeField(null); | 186 testNativeField(null); |
| 187 testMixinInstantiation(); |
| 188 testNamedMixinInstantiation(); |
| 187 } | 189 } |
| 188 | 190 |
| 189 testEmpty() {} | 191 testEmpty() {} |
| 190 testNull() => null; | 192 testNull() => null; |
| 191 testTrue() => true; | 193 testTrue() => true; |
| 192 testFalse() => false; | 194 testFalse() => false; |
| 193 testInt() => 42; | 195 testInt() => 42; |
| 194 testDouble() => 37.5; | 196 testDouble() => 37.5; |
| 195 testString() => 'foo'; | 197 testString() => 'foo'; |
| 196 testStringInterpolation() => '${0}'; | 198 testStringInterpolation() => '${0}'; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 testNativeMethodReturns() native; | 621 testNativeMethodReturns() native; |
| 620 | 622 |
| 621 @Native("NativeClass") | 623 @Native("NativeClass") |
| 622 class NativeClass { | 624 class NativeClass { |
| 623 @annotation_Creates_SerializedScriptValue | 625 @annotation_Creates_SerializedScriptValue |
| 624 final Object field; | 626 final Object field; |
| 625 | 627 |
| 626 factory NativeClass._() { throw new UnsupportedError("Not supported"); } | 628 factory NativeClass._() { throw new UnsupportedError("Not supported"); } |
| 627 } | 629 } |
| 628 testNativeField(NativeClass c) => c.field; | 630 testNativeField(NativeClass c) => c.field; |
| 631 testMixinInstantiation() => new Sub(); |
| 632 testNamedMixinInstantiation() => new NamedMixin(); |
| 629 ''', | 633 ''', |
| 630 'sdk/tests/compiler/dart2js_native/helper.dart': ''' | 634 'sdk/tests/compiler/dart2js_native/helper.dart': ''' |
| 631 import 'dart:_js_helper'; | 635 import 'dart:_js_helper'; |
| 632 class Class { | 636 class Class { |
| 633 const Class.generative(); | 637 const Class.generative(); |
| 634 factory Class.fact() => null; | 638 factory Class.fact() => null; |
| 635 const factory Class.redirect() = Class.generative; | 639 const factory Class.redirect() = Class.generative; |
| 636 } | 640 } |
| 637 class GenericClass<X, Y> { | 641 class GenericClass<X, Y> { |
| 638 const GenericClass.generative(); | 642 const GenericClass.generative(); |
| 639 factory GenericClass.fact() => null; | 643 factory GenericClass.fact() => null; |
| 640 const factory GenericClass.redirect() = GenericClass<X, Y>.generative; | 644 const factory GenericClass.redirect() = GenericClass<X, Y>.generative; |
| 641 | 645 |
| 642 Map<X, T> genericMethod<T>(T arg) => { null: arg }; | 646 Map<X, T> genericMethod<T>(T arg) => { null: arg }; |
| 643 } | 647 } |
| 644 typedef Typedef(); | 648 typedef Typedef(); |
| 645 typedef X GenericTypedef<X, Y>(Y y); | 649 typedef X GenericTypedef<X, Y>(Y y); |
| 646 | 650 |
| 651 class Super {} |
| 652 class Mixin1 {} |
| 653 class Mixin2 {} |
| 654 class Sub extends Super with Mixin1, Mixin2 {} |
| 655 class NamedMixin = Super with Mixin1, Mixin2; |
| 656 |
| 647 const String _serializedScriptValue = | 657 const String _serializedScriptValue = |
| 648 'num|String|bool|' | 658 'num|String|bool|' |
| 649 'JSExtendableArray|=Object'; | 659 'JSExtendableArray|=Object'; |
| 650 const annotation_Creates_SerializedScriptValue = | 660 const annotation_Creates_SerializedScriptValue = |
| 651 const Creates(_serializedScriptValue);''', | 661 const Creates(_serializedScriptValue);''', |
| 652 }; | 662 }; |
| 653 | 663 |
| 654 main(List<String> args) { | 664 main(List<String> args) { |
| 655 bool fullTest = args.contains('--full'); | 665 bool fullTest = args.contains('--full'); |
| 656 asyncTest(() async { | 666 asyncTest(() async { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 visitList(type.optionalParameterTypes), | 874 visitList(type.optionalParameterTypes), |
| 865 type.namedParameters, | 875 type.namedParameters, |
| 866 visitList(type.namedParameterTypes)); | 876 visitList(type.namedParameterTypes)); |
| 867 } | 877 } |
| 868 } | 878 } |
| 869 | 879 |
| 870 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType]. | 880 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType]. |
| 871 ResolutionDartType unalias(ResolutionDartType type) { | 881 ResolutionDartType unalias(ResolutionDartType type) { |
| 872 return const Unaliaser().visit(type); | 882 return const Unaliaser().visit(type); |
| 873 } | 883 } |
| OLD | NEW |