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

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

Issue 2686243004: Handler the last native annotations (Closed)
Patch Set: Cleanup. Created 3 years, 10 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 '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 16 matching lines...) Expand all
27 import 'package:kernel/ast.dart' as ir; 27 import 'package:kernel/ast.dart' as ir;
28 import '../memory_compiler.dart'; 28 import '../memory_compiler.dart';
29 import '../serialization/test_helper.dart'; 29 import '../serialization/test_helper.dart';
30 30
31 const Map<String, String> SOURCE = const <String, String>{ 31 const Map<String, String> SOURCE = const <String, String>{
32 // Pretend this is a dart2js_native test to allow use of 'native' keyword. 32 // Pretend this is a dart2js_native test to allow use of 'native' keyword.
33 'sdk/tests/compiler/dart2js_native/main.dart': r''' 33 'sdk/tests/compiler/dart2js_native/main.dart': r'''
34 import 'dart:_foreign_helper'; 34 import 'dart:_foreign_helper';
35 import 'dart:_js_helper'; 35 import 'dart:_js_helper';
36 import 'dart:_interceptors'; 36 import 'dart:_interceptors';
37 import 'dart:_native_typed_data';
38 import 'dart:indexed_db';
39 import 'dart:html';
40 import 'dart:html_common';
41 import 'dart:math';
42 import 'dart:typed_data';
43 import 'dart:web_sql';
37 import 'helper.dart'; 44 import 'helper.dart';
38 import 'dart:html';
39 45
40 main() { 46 main() {
41 testEmpty(); 47 testEmpty();
42 testNull(); 48 testNull();
43 testTrue(); 49 testTrue();
44 testFalse(); 50 testFalse();
45 testInt(); 51 testInt();
46 testDouble(); 52 testDouble();
47 testString(); 53 testString();
48 testStringInterpolation(); 54 testStringInterpolation();
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 List<T> staticGenericMethod<T>(T arg) => [arg]; 613 List<T> staticGenericMethod<T>(T arg) => [arg];
608 testStaticGenericMethod() { 614 testStaticGenericMethod() {
609 staticGenericMethod<int>(0); 615 staticGenericMethod<int>(0);
610 } 616 }
611 617
612 testInstanceGenericMethod() { 618 testInstanceGenericMethod() {
613 new GenericClass<int, String>.generative().genericMethod<bool>(false); 619 new GenericClass<int, String>.generative().genericMethod<bool>(false);
614 } 620 }
615 621
616 testDynamicPrivateMethodInvoke([o]) => o._privateMethod(); 622 testDynamicPrivateMethodInvoke([o]) => o._privateMethod();
617 testJSCall() => JS('int|bool', '#', null); 623 testJSCall() => JS('int|bool|NativeUint8List|Rectangle|IdbFactory|'
624 'SqlDatabase|TypedData|ContextAttributes', '#', null);
618 @JSName('foo') 625 @JSName('foo')
626 @SupportedBrowser(SupportedBrowser.CHROME)
619 testNativeMethod() native; 627 testNativeMethod() native;
620 @Creates('int|Null|JSArray') 628 @Creates('int|Null|JSArray')
621 testNativeMethodCreates() native; 629 testNativeMethodCreates() native;
622 @Returns('String|Null|JSArray') 630 @Returns('String|Null|JSArray')
623 testNativeMethodReturns() native; 631 testNativeMethodReturns() native;
624 632
625 @Native("NativeClass") 633 @Native("NativeClass")
626 class NativeClass { 634 class NativeClass {
627 @annotation_Creates_SerializedScriptValue 635 @annotation_Creates_SerializedScriptValue
628 final Object field; 636 final Object field;
(...skipping 29 matching lines...) Expand all
658 class Sub extends Super with Mixin1, Mixin2 {} 666 class Sub extends Super with Mixin1, Mixin2 {}
659 class NamedMixin = Super with Mixin1, Mixin2; 667 class NamedMixin = Super with Mixin1, Mixin2;
660 668
661 class GenericSuper<X, Y> {} 669 class GenericSuper<X, Y> {}
662 class GenericMixin1<X, Y> {} 670 class GenericMixin1<X, Y> {}
663 class GenericMixin2<X, Y> {} 671 class GenericMixin2<X, Y> {}
664 class GenericSub<X, Y> extends GenericSuper<X, Y> 672 class GenericSub<X, Y> extends GenericSuper<X, Y>
665 with GenericMixin1<X, Y>, GenericMixin2<X, Y> {} 673 with GenericMixin1<X, Y>, GenericMixin2<X, Y> {}
666 class GenericNamedMixin<X, Y> = GenericSuper<X, Y> 674 class GenericNamedMixin<X, Y> = GenericSuper<X, Y>
667 with GenericMixin1<X, Y>, GenericMixin2<X, Y>; 675 with GenericMixin1<X, Y>, GenericMixin2<X, Y>;
668 676 ''',
669 const String _serializedScriptValue =
670 'num|String|bool|'
671 'JSExtendableArray|=Object';
672 const annotation_Creates_SerializedScriptValue =
673 const Creates(_serializedScriptValue);''',
Siggi Cherem (dart-lang) 2017/02/10 23:00:54 revert? this annotation is still used in NativeCla
Johnni Winther 2017/02/12 09:51:49 Yes, but now it's directly accessible through impo
674 }; 677 };
675 678
676 main(List<String> args) { 679 main(List<String> args) {
677 bool fullTest = args.contains('--full'); 680 bool fullTest = args.contains('--full');
678 asyncTest(() async { 681 asyncTest(() async {
679 enableDebugMode(); 682 enableDebugMode();
680 Uri entryPoint = 683 Uri entryPoint =
681 Uri.parse('memory:sdk/tests/compiler/dart2js_native/main.dart'); 684 Uri.parse('memory:sdk/tests/compiler/dart2js_native/main.dart');
682 Compiler compiler = compilerFor( 685 Compiler compiler = compilerFor(
683 entryPoint: entryPoint, 686 entryPoint: entryPoint,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 visitList(type.optionalParameterTypes), 889 visitList(type.optionalParameterTypes),
887 type.namedParameters, 890 type.namedParameters,
888 visitList(type.namedParameterTypes)); 891 visitList(type.namedParameterTypes));
889 } 892 }
890 } 893 }
891 894
892 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType]. 895 /// Perform unaliasing of all typedefs nested within a [ResolutionDartType].
893 ResolutionDartType unalias(ResolutionDartType type) { 896 ResolutionDartType unalias(ResolutionDartType type) {
894 return const Unaliaser().visit(type); 897 return const Unaliaser().visit(type);
895 } 898 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698