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

Side by Side Diff: pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart

Issue 11338036: Member functions added to ClassMirror (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
« no previous file with comments | « pkg/dartdoc/lib/mirrors.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 library mirrors_dart2js; 5 library mirrors_dart2js;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:uri'; 8 import 'dart:uri';
9 9
10 import '../../../../../lib/compiler/compiler.dart' as diagnostics; 10 import '../../../../../lib/compiler/compiler.dart' as diagnostics;
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 } 746 }
747 }); 747 });
748 } 748 }
749 } 749 }
750 750
751 Map<String, MemberMirror> get declaredMembers { 751 Map<String, MemberMirror> get declaredMembers {
752 _ensureMembers(); 752 _ensureMembers();
753 return new ImmutableMapWrapper<String, MemberMirror>(_members); 753 return new ImmutableMapWrapper<String, MemberMirror>(_members);
754 } 754 }
755 755
756 Map<String, Mirror> get members => declaredMembers;
757
758 Map<String, MethodMirror> get methods {
759 _ensureMembers();
760 return new FilteredImmutableMap(_members,
761 (MemberMirror member) => member is MethodMirror);
762 }
763
764 Map<String, MethodMirror> get getters {
765 _ensureMembers();
766 return new FilteredImmutableMap(_members,
767 (MemberMirror member) => member is MethodMirror && member.isGetter);
768 }
769
770 Map<String, MethodMirror> get setters {
771 _ensureMembers();
772 return new FilteredImmutableMap(_members,
773 (MemberMirror member) => member is MethodMirror && member.isSetter);
774 }
775
756 bool get isObject => _class == system.compiler.objectClass; 776 bool get isObject => _class == system.compiler.objectClass;
757 777
758 bool get isDynamic => false; 778 bool get isDynamic => false;
759 779
760 bool get isVoid => false; 780 bool get isVoid => false;
761 781
762 bool get isTypeVariable => false; 782 bool get isTypeVariable => false;
763 783
764 bool get isTypedef => false; 784 bool get isTypedef => false;
765 785
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 system.compiler.resolveTypedef(_typedef.element); 919 system.compiler.resolveTypedef(_typedef.element);
900 _definition = _convertTypeToTypeMirror( 920 _definition = _convertTypeToTypeMirror(
901 system, 921 system,
902 _typedef.element.alias, 922 _typedef.element.alias,
903 system.compiler.types.dynamicType, 923 system.compiler.types.dynamicType,
904 _typedef.element.functionSignature); 924 _typedef.element.functionSignature);
905 } 925 }
906 return _definition; 926 return _definition;
907 } 927 }
908 928
909 Map<String, MemberMirror> get declaredMembers =>
910 const <String, MemberMirror>{};
911
912 ClassMirror get originalDeclaration => this; 929 ClassMirror get originalDeclaration => this;
913 930
914 // TODO(johnniwinther): How should a typedef respond to these? 931 // TODO(johnniwinther): How should a typedef respond to these?
915 ClassMirror get superclass => null; 932 ClassMirror get superclass => null;
916 933
917 List<ClassMirror> get superinterfaces => const <ClassMirror>[]; 934 List<ClassMirror> get superinterfaces => const <ClassMirror>[];
918 935
919 bool get isClass => false; 936 bool get isClass => false;
920 937
921 bool get isInterface => false; 938 bool get isInterface => false;
922 939
923 bool get isOriginalDeclaration => true; 940 bool get isOriginalDeclaration => true;
924 941
925 bool get isAbstract => false; 942 bool get isAbstract => false;
926
927 Map<String, MethodMirror> get constructors =>
928 const <String, MethodMirror>{};
929
930 ClassMirror get defaultFactory => null;
931 } 943 }
932 944
933 class Dart2JsTypeVariableMirror extends Dart2JsTypeElementMirror 945 class Dart2JsTypeVariableMirror extends Dart2JsTypeElementMirror
934 implements TypeVariableMirror { 946 implements TypeVariableMirror {
935 final TypeVariableType _typeVariableType; 947 final TypeVariableType _typeVariableType;
936 ClassMirror _declarer; 948 ClassMirror _declarer;
937 949
938 Dart2JsTypeVariableMirror(Dart2JsMirrorSystem system, 950 Dart2JsTypeVariableMirror(Dart2JsMirrorSystem system,
939 TypeVariableType typeVariableType) 951 TypeVariableType typeVariableType)
940 : this._typeVariableType = typeVariableType, 952 : this._typeVariableType = typeVariableType,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 1026
1015 bool get isDynamic => false; 1027 bool get isDynamic => false;
1016 1028
1017 bool get isTypeVariable => false; 1029 bool get isTypeVariable => false;
1018 1030
1019 bool get isTypedef => false; 1031 bool get isTypedef => false;
1020 1032
1021 bool get isFunction => false; 1033 bool get isFunction => false;
1022 1034
1023 String toString() => _type.element.toString(); 1035 String toString() => _type.element.toString();
1036
1037 Map<String, MemberMirror> get declaredMembers =>
1038 const <String, MemberMirror>{};
1039
1040 Map<String, MemberMirror> get members => const <String, MemberMirror>{};
1041
1042 Map<String, MethodMirror> get constructors => const <String, MethodMirror>{};
1043
1044 Map<String, MethodMirror> get methods => const <String, MethodMirror>{};
1045
1046 Map<String, MethodMirror> get getters => const <String, MethodMirror>{};
1047
1048 Map<String, MethodMirror> get setters => const <String, MethodMirror>{};
1049
1050 ClassMirror get defaultFactory => null;
1024 } 1051 }
1025 1052
1026 class Dart2JsInterfaceTypeMirror extends Dart2JsTypeElementMirror 1053 class Dart2JsInterfaceTypeMirror extends Dart2JsTypeElementMirror
1027 implements ClassMirror { 1054 implements ClassMirror {
1028 List<TypeMirror> _typeArguments; 1055 List<TypeMirror> _typeArguments;
1029 1056
1030 Dart2JsInterfaceTypeMirror(Dart2JsMirrorSystem system, 1057 Dart2JsInterfaceTypeMirror(Dart2JsMirrorSystem system,
1031 InterfaceType interfaceType) 1058 InterfaceType interfaceType)
1032 : super(system, interfaceType); 1059 : super(system, interfaceType);
1033 1060
1034 InterfaceType get _interfaceType => _type; 1061 InterfaceType get _interfaceType => _type;
1035 1062
1036 String get qualifiedName => originalDeclaration.qualifiedName; 1063 String get qualifiedName => originalDeclaration.qualifiedName;
1037 1064
1038 // TODO(johnniwinther): Substitute type arguments for type variables. 1065 // TODO(johnniwinther): Substitute type arguments for type variables.
1039 Map<String, MemberMirror> get declaredMembers => originalDeclaration.declaredM embers; 1066 Map<String, MemberMirror> get declaredMembers =>
1067 originalDeclaration.declaredMembers;
1068
1069 // TODO(johnniwinther): Substitute type arguments for type variables.
1070 Map<String, MemberMirror> get members => originalDeclaration.members;
1040 1071
1041 bool get isObject => system.compiler.objectClass == _type.element; 1072 bool get isObject => system.compiler.objectClass == _type.element;
1042 1073
1043 bool get isDynamic => system.compiler.dynamicClass == _type.element; 1074 bool get isDynamic => system.compiler.dynamicClass == _type.element;
1044 1075
1045 ClassMirror get originalDeclaration 1076 ClassMirror get originalDeclaration
1046 => new Dart2JsClassMirror(system, _type.element); 1077 => new Dart2JsClassMirror(system, _type.element);
1047 1078
1048 // TODO(johnniwinther): Substitute type arguments for type variables. 1079 // TODO(johnniwinther): Substitute type arguments for type variables.
1049 ClassMirror get superclass => originalDeclaration.superclass; 1080 ClassMirror get superclass => originalDeclaration.superclass;
(...skipping 17 matching lines...) Expand all
1067 Link<DartType> type = _interfaceType.arguments; 1098 Link<DartType> type = _interfaceType.arguments;
1068 while (type != null && type.head != null) { 1099 while (type != null && type.head != null) {
1069 _typeArguments.add(_convertTypeToTypeMirror(system, type.head, 1100 _typeArguments.add(_convertTypeToTypeMirror(system, type.head,
1070 system.compiler.types.dynamicType)); 1101 system.compiler.types.dynamicType));
1071 type = type.tail; 1102 type = type.tail;
1072 } 1103 }
1073 } 1104 }
1074 return _typeArguments; 1105 return _typeArguments;
1075 } 1106 }
1076 1107
1077 List<TypeVariableMirror> get typeVariables => originalDeclaration.typeVariable s; 1108 List<TypeVariableMirror> get typeVariables =>
1109 originalDeclaration.typeVariables;
1078 1110
1079 // TODO(johnniwinther): Substitute type arguments for type variables. 1111 // TODO(johnniwinther): Substitute type arguments for type variables.
1080 Map<String, MethodMirror> get constructors => originalDeclaration.constructors ; 1112 Map<String, MethodMirror> get constructors =>
1113 originalDeclaration.constructors;
1114
1115 // TODO(johnniwinther): Substitute type arguments for type variables.
1116 Map<String, MethodMirror> get methods => originalDeclaration.methods;
1117
1118 // TODO(johnniwinther): Substitute type arguments for type variables.
1119 Map<String, MethodMirror> get setters => originalDeclaration.setters;
1120
1121 // TODO(johnniwinther): Substitute type arguments for type variables.
1122 Map<String, MethodMirror> get getters => originalDeclaration.getters;
1081 1123
1082 // TODO(johnniwinther): Substitute type arguments for type variables? 1124 // TODO(johnniwinther): Substitute type arguments for type variables?
1083 ClassMirror get defaultFactory => originalDeclaration.defaultFactory; 1125 ClassMirror get defaultFactory => originalDeclaration.defaultFactory;
1084 1126
1085 bool operator ==(Object other) { 1127 bool operator ==(Object other) {
1086 if (this === other) { 1128 if (this === other) {
1087 return true; 1129 return true;
1088 } 1130 }
1089 if (other is! ClassMirror) { 1131 if (other is! ClassMirror) {
1090 return false; 1132 return false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 bool get isPrivate => originalDeclaration.isPrivate; 1201 bool get isPrivate => originalDeclaration.isPrivate;
1160 1202
1161 bool get isOriginalDeclaration => false; 1203 bool get isOriginalDeclaration => false;
1162 1204
1163 bool get isAbstract => false; 1205 bool get isAbstract => false;
1164 1206
1165 List<TypeMirror> get typeArguments => const <TypeMirror>[]; 1207 List<TypeMirror> get typeArguments => const <TypeMirror>[];
1166 1208
1167 List<TypeVariableMirror> get typeVariables => originalDeclaration.typeVariable s; 1209 List<TypeVariableMirror> get typeVariables => originalDeclaration.typeVariable s;
1168 1210
1169 Map<String, MethodMirror> get constructors => <String, MethodMirror>{};
1170
1171 ClassMirror get defaultFactory => null;
1172
1173 TypeMirror get returnType { 1211 TypeMirror get returnType {
1174 return _convertTypeToTypeMirror(system, _functionType.returnType, 1212 return _convertTypeToTypeMirror(system, _functionType.returnType,
1175 system.compiler.types.dynamicType); 1213 system.compiler.types.dynamicType);
1176 } 1214 }
1177 1215
1178 List<ParameterMirror> get parameters { 1216 List<ParameterMirror> get parameters {
1179 if (_parameters === null) { 1217 if (_parameters === null) {
1180 _parameters = _parametersFromFunctionSignature(system, callMethod, 1218 _parameters = _parametersFromFunctionSignature(system, callMethod,
1181 _functionSignature); 1219 _functionSignature);
1182 } 1220 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 if (node !== null) { 1463 if (node !== null) {
1426 var span = system.compiler.spanFromNode(node, script.uri); 1464 var span = system.compiler.spanFromNode(node, script.uri);
1427 return new Dart2JsLocation(script, span); 1465 return new Dart2JsLocation(script, span);
1428 } else { 1466 } else {
1429 var span = system.compiler.spanFromElement(_variable); 1467 var span = system.compiler.spanFromElement(_variable);
1430 return new Dart2JsLocation(script, span); 1468 return new Dart2JsLocation(script, span);
1431 } 1469 }
1432 } 1470 }
1433 } 1471 }
1434 1472
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/mirrors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698