Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); | 187 testMixinInstantiation(); |
| 188 testNamedMixinInstantiation(); | 188 testNamedMixinInstantiation(); |
| 189 testGenericMixinInstantiation(); | |
| 190 testGenericNamedMixinInstantiation(); | |
| 189 } | 191 } |
| 190 | 192 |
| 191 testEmpty() {} | 193 testEmpty() {} |
| 192 testNull() => null; | 194 testNull() => null; |
| 193 testTrue() => true; | 195 testTrue() => true; |
| 194 testFalse() => false; | 196 testFalse() => false; |
| 195 testInt() => 42; | 197 testInt() => 42; |
| 196 testDouble() => 37.5; | 198 testDouble() => 37.5; |
| 197 testString() => 'foo'; | 199 testString() => 'foo'; |
| 198 testStringInterpolation() => '${0}'; | 200 testStringInterpolation() => '${0}'; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 @Native("NativeClass") | 625 @Native("NativeClass") |
| 624 class NativeClass { | 626 class NativeClass { |
| 625 @annotation_Creates_SerializedScriptValue | 627 @annotation_Creates_SerializedScriptValue |
| 626 final Object field; | 628 final Object field; |
| 627 | 629 |
| 628 factory NativeClass._() { throw new UnsupportedError("Not supported"); } | 630 factory NativeClass._() { throw new UnsupportedError("Not supported"); } |
| 629 } | 631 } |
| 630 testNativeField(NativeClass c) => c.field; | 632 testNativeField(NativeClass c) => c.field; |
| 631 testMixinInstantiation() => new Sub(); | 633 testMixinInstantiation() => new Sub(); |
| 632 testNamedMixinInstantiation() => new NamedMixin(); | 634 testNamedMixinInstantiation() => new NamedMixin(); |
| 635 testGenericMixinInstantiation() => new GenericSub<int, String>(); | |
| 636 testGenericNamedMixinInstantiation() => new GenericNamedMixin<int, String>(); | |
| 633 ''', | 637 ''', |
| 634 'sdk/tests/compiler/dart2js_native/helper.dart': ''' | 638 'sdk/tests/compiler/dart2js_native/helper.dart': ''' |
| 635 import 'dart:_js_helper'; | 639 import 'dart:_js_helper'; |
| 636 class Class { | 640 class Class { |
| 637 const Class.generative(); | 641 const Class.generative(); |
| 638 factory Class.fact() => null; | 642 factory Class.fact() => null; |
| 639 const factory Class.redirect() = Class.generative; | 643 const factory Class.redirect() = Class.generative; |
| 640 } | 644 } |
| 641 class GenericClass<X, Y> { | 645 class GenericClass<X, Y> { |
| 642 const GenericClass.generative(); | 646 const GenericClass.generative(); |
| 643 factory GenericClass.fact() => null; | 647 factory GenericClass.fact() => null; |
| 644 const factory GenericClass.redirect() = GenericClass<X, Y>.generative; | 648 const factory GenericClass.redirect() = GenericClass<X, Y>.generative; |
| 645 | 649 |
| 646 Map<X, T> genericMethod<T>(T arg) => { null: arg }; | 650 Map<X, T> genericMethod<T>(T arg) => { null: arg }; |
| 647 } | 651 } |
| 648 typedef Typedef(); | 652 typedef Typedef(); |
| 649 typedef X GenericTypedef<X, Y>(Y y); | 653 typedef X GenericTypedef<X, Y>(Y y); |
| 650 | 654 |
| 651 class Super {} | 655 class Super {} |
| 652 class Mixin1 {} | 656 class Mixin1 {} |
| 653 class Mixin2 {} | 657 class Mixin2 {} |
| 654 class Sub extends Super with Mixin1, Mixin2 {} | 658 class Sub extends Super with Mixin1, Mixin2 {} |
| 655 class NamedMixin = Super with Mixin1, Mixin2; | 659 class NamedMixin = Super with Mixin1, Mixin2; |
| 656 | 660 |
| 661 class GenericSuper<X, Y> {} | |
| 662 class GenericMixin1<X, Y> {} | |
| 663 class GenericMixin2<X, Y> {} | |
| 664 class GenericSub<X, Y> extends GenericSuper<X, Y> | |
|
Siggi Cherem (dart-lang)
2017/02/10 22:11:22
it might be interesting to test using different na
Johnni Winther
2017/02/12 09:46:43
Done.
| |
| 665 with GenericMixin1<X, Y>, GenericMixin2<X, Y> {} | |
| 666 class GenericNamedMixin<X, Y> = GenericSuper<X, Y> | |
| 667 with GenericMixin1<X, Y>, GenericMixin2<X, Y>; | |
| 668 | |
| 657 const String _serializedScriptValue = | 669 const String _serializedScriptValue = |
| 658 'num|String|bool|' | 670 'num|String|bool|' |
| 659 'JSExtendableArray|=Object'; | 671 'JSExtendableArray|=Object'; |
| 660 const annotation_Creates_SerializedScriptValue = | 672 const annotation_Creates_SerializedScriptValue = |
| 661 const Creates(_serializedScriptValue);''', | 673 const Creates(_serializedScriptValue);''', |
| 662 }; | 674 }; |
| 663 | 675 |
| 664 main(List<String> args) { | 676 main(List<String> args) { |
| 665 bool fullTest = args.contains('--full'); | 677 bool fullTest = args.contains('--full'); |
| 666 asyncTest(() async { | 678 asyncTest(() async { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 visitList(type.optionalParameterTypes), | 886 visitList(type.optionalParameterTypes), |
| 875 type.namedParameters, | 887 type.namedParameters, |
| 876 visitList(type.namedParameterTypes)); | 888 visitList(type.namedParameterTypes)); |
| 877 } | 889 } |
| 878 } | 890 } |
| 879 | 891 |
| 880 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType]. | 892 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType]. |
| 881 ResolutionDartType unalias(ResolutionDartType type) { | 893 ResolutionDartType unalias(ResolutionDartType type) { |
| 882 return const Unaliaser().visit(type); | 894 return const Unaliaser().visit(type); |
| 883 } | 895 } |
| OLD | NEW |