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

Side by Side Diff: tests/compiler/dart2js/mirrors_test.dart

Issue 11338031: Introduce DeclarationMirror (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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("../../../pkg/dartdoc/lib/mirrors.dart"); 5 #import("../../../pkg/dartdoc/lib/mirrors.dart");
6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart"); 6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart");
7 7
8 #import('dart:io'); 8 #import('dart:io');
9 9
10 int count(Iterable iterable) { 10 int count(Iterable iterable) {
11 var count = 0; 11 var count = 0;
12 for (var element in iterable) { 12 for (var element in iterable) {
13 count++; 13 count++;
14 } 14 }
15 return count; 15 return count;
16 } 16 }
17 17
18 bool containsType(TypeMirror expected, Iterable<TypeMirror> iterable) { 18 bool containsType(TypeMirror expected, Iterable<TypeMirror> iterable) {
19 for (var element in iterable) { 19 for (var element in iterable) {
20 if (element.declaration == expected.declaration) { 20 if (element.declaration == expected.declaration) {
21 return true; 21 return true;
22 } 22 }
23 } 23 }
24 return false; 24 return false;
25 } 25 }
26 26
27 Mirror findMirror(List<Mirror> list, String name) { 27 DeclarationMirror findMirror(List<DeclarationMirror> list, String name) {
28 for (Mirror mirror in list) { 28 for (DeclarationMirror mirror in list) {
29 if (mirror.simpleName == name) { 29 if (mirror.simpleName == name) {
30 return mirror; 30 return mirror;
31 } 31 }
32 } 32 }
33 return null; 33 return null;
34 } 34 }
35 35
36 main() { 36 main() {
37 var scriptPath = new Path.fromNative(new Options().script); 37 var scriptPath = new Path.fromNative(new Options().script);
38 var dirPath = scriptPath.directoryPath; 38 var dirPath = scriptPath.directoryPath;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 Expect.isTrue(privateConstructor.isConstructor); 732 Expect.isTrue(privateConstructor.isConstructor);
733 Expect.isTrue(privateConstructor.isPrivate); 733 Expect.isTrue(privateConstructor.isPrivate);
734 734
735 var privateFactoryConstructor = 735 var privateFactoryConstructor =
736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor']; 736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor'];
737 Expect.isNotNull(privateFactoryConstructor); 737 Expect.isNotNull(privateFactoryConstructor);
738 Expect.isTrue(privateFactoryConstructor is MethodMirror); 738 Expect.isTrue(privateFactoryConstructor is MethodMirror);
739 Expect.isTrue(privateFactoryConstructor.isFactory); 739 Expect.isTrue(privateFactoryConstructor.isFactory);
740 Expect.isTrue(privateFactoryConstructor.isPrivate); 740 Expect.isTrue(privateFactoryConstructor.isPrivate);
741 } 741 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698