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

Side by Side Diff: tests/compiler/dart2js/backend_dart/dart_backend_test.dart

Issue 764023005: Generate typedef node from the element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix unittest Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:async'; 6 import 'dart:async';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import '../mock_compiler.dart'; 8 import '../mock_compiler.dart';
9 import '../mock_libraries.dart'; 9 import '../mock_libraries.dart';
10 import 'package:compiler/compiler.dart'; 10 import 'package:compiler/compiler.dart';
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 class A { 208 class A {
209 static const String a = "5"; 209 static const String a = "5";
210 static const String b = "4"; 210 static const String b = "4";
211 } 211 }
212 '''); 212 ''');
213 // Class member of typedef-ed function type. 213 // Class member of typedef-ed function type.
214 // Maybe typedef should be included in the result too, but it 214 // Maybe typedef should be included in the result too, but it
215 // works fine without it. 215 // works fine without it.
216 testDart2Dart(''' 216 testDart2Dart('''
217 typedef void foofunc(arg); 217 typedef void foofunc(_0);
218 main() { 218 main() {
219 new A((arg) {}); 219 new A((arg) {});
220 } 220 }
221 class A { 221 class A {
222 A(foofunc this.handler); 222 A(foofunc this.handler);
223 final foofunc handler; 223 final foofunc handler;
224 } 224 }
225 '''); 225 ''');
226 } 226 }
227 227
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 class A { 593 class A {
594 B field; 594 B field;
595 } 595 }
596 '''); 596 ''');
597 } 597 }
598 598
599 class DynoMap implements Map<Element, ElementAst> { 599 class DynoMap implements Map<Element, ElementAst> {
600 final compiler; 600 final compiler;
601 DynoMap(this.compiler); 601 DynoMap(this.compiler);
602 602
603 ElementAst operator[](Element element) => new ElementAst(element); 603 ElementAst operator[](AstElement element) {
604 return new ElementAst(element.resolvedAst.node,
605 element.resolvedAst.elements);
606 }
604 607
605 noSuchMethod(Invocation invocation) => throw 'unimplemented method'; 608 noSuchMethod(Invocation invocation) => throw 'unimplemented method';
606 } 609 }
607 610
608 PlaceholderCollector collectPlaceholders(compiler, element) { 611 PlaceholderCollector collectPlaceholders(compiler, element) {
609 DartBackend backend = compiler.backend; 612 DartBackend backend = compiler.backend;
610 return new PlaceholderCollector(compiler, 613 return new PlaceholderCollector(compiler,
611 backend.mirrorRenamer, 614 backend.mirrorRenamer,
612 new Set<String>(), 615 new Set<String>(),
613 new DynoMap(compiler), 616 new DynoMap(compiler),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 MyFunction myf1; 665 MyFunction myf1;
663 mylib.MyFunction myf2; 666 mylib.MyFunction myf2;
664 new A<int>().f; 667 new A<int>().f;
665 new T(); 668 new T();
666 669
667 new mylib.A<int>().f; 670 new mylib.A<int>().f;
668 new mylib.T(); 671 new mylib.T();
669 } 672 }
670 '''; 673 ''';
671 var expectedResult = ''' 674 var expectedResult = '''
672 typedef void MyFunction<T_B extends num>(T_B arg); 675 typedef void MyFunction<T_B extends num>(T_B _0);
673 class T {} 676 class T {}
674 class B<T_B> {} 677 class B<T_B> {}
675 class A<T_B> extends B<T_B> { 678 class A<T_B> extends B<T_B> {
676 T_B f; 679 T_B f;
677 } 680 }
678 typedef void MyFunction_A<T_B extends num>(T_B arg); 681 typedef void MyFunction_A<T_B extends num>(T_B _0);
679 class T_A {} 682 class T_A {}
680 class B_A<T_B> {} 683 class B_A<T_B> {}
681 class A_A<T_B> extends B_A<T_B> { 684 class A_A<T_B> extends B_A<T_B> {
682 T_B f; 685 T_B f;
683 } 686 }
684 main() { 687 main() {
685 MyFunction_A myf1; 688 MyFunction_A myf1;
686 MyFunction myf2; 689 MyFunction myf2;
687 new A_A<int>().f; 690 new A_A<int>().f;
688 new T_A(); 691 new T_A();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 testParametersMinified(); 1103 testParametersMinified();
1101 testDeclarationTypePlaceholders(); 1104 testDeclarationTypePlaceholders();
1102 testPlatformLibraryMemberNamesAreFixed(); 1105 testPlatformLibraryMemberNamesAreFixed();
1103 testConflictsWithCoreLib(); 1106 testConflictsWithCoreLib();
1104 testUnresolvedNamedConstructor1(); 1107 testUnresolvedNamedConstructor1();
1105 testUnresolvedNamedConstructor2(); 1108 testUnresolvedNamedConstructor2();
1106 testUnresolvedNamedConstructor3(); 1109 testUnresolvedNamedConstructor3();
1107 testClassAndNamedMixinDeclarations(); 1110 testClassAndNamedMixinDeclarations();
1108 } 1111 }
1109 1112
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698