Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this | 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in | 2 // source code is governed by a BSD-style license that can be found in |
| 3 // the LICENSE file. | 3 // the LICENSE file. |
| 4 | 4 |
| 5 import '../mirrors.dart'; | 5 import '../mirrors.dart'; |
| 6 import 'encoding_constants.dart' as constants; | 6 import 'encoding_constants.dart' as constants; |
| 7 export 'dart:collection' show UnmodifiableMapView; | 7 export 'dart:collection' show UnmodifiableMapView; |
| 8 export '../capability.dart'; | 8 export '../capability.dart'; |
| 9 export '../static_reflectable.dart'; | 9 export '../static_reflectable.dart'; |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 implements TypedefMirror { | 139 implements TypedefMirror { |
| 140 FunctionTypeMirror get referent => _unsupported(); | 140 FunctionTypeMirror get referent => _unsupported(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 abstract class MethodMirrorUnimpl extends DeclarationMirrorUnimpl | 143 abstract class MethodMirrorUnimpl extends DeclarationMirrorUnimpl |
| 144 implements MethodMirror { | 144 implements MethodMirror { |
| 145 TypeMirror get returnType => _unsupported(); | 145 TypeMirror get returnType => _unsupported(); |
| 146 String get source => _unsupported(); | 146 String get source => _unsupported(); |
| 147 List<ParameterMirror> get parameters => _unsupported(); | 147 List<ParameterMirror> get parameters => _unsupported(); |
| 148 bool get isStatic => _unsupported(); | 148 bool get isStatic => _unsupported(); |
| 149 bool get isAbstract => _unsupported(); | 149 // We do not support reflection on abstract methods. |
|
eernst
2015/06/18 10:07:18
Let's include abstract methods even though dart:mi
sigurdm
2015/06/18 11:04:03
Done.
| |
| 150 bool get isAbstract => false; | |
| 150 bool get isSynthetic => _unsupported(); | 151 bool get isSynthetic => _unsupported(); |
| 151 bool get isRegularMethod => _unsupported(); | 152 bool get isRegularMethod => _unsupported(); |
| 152 bool get isOperator => _unsupported(); | 153 bool get isOperator => _unsupported(); |
| 153 bool get isGetter => _unsupported(); | 154 bool get isGetter => _unsupported(); |
| 154 bool get isSetter => _unsupported(); | 155 bool get isSetter => _unsupported(); |
| 155 bool get isConstructor => _unsupported(); | 156 bool get isConstructor => _unsupported(); |
| 156 String get constructorName => _unsupported(); | 157 String get constructorName => _unsupported(); |
| 157 bool get isConstConstructor => _unsupported(); | 158 bool get isConstConstructor => _unsupported(); |
| 158 bool get isGenerativeConstructor => _unsupported(); | 159 bool get isGenerativeConstructor => _unsupported(); |
| 159 bool get isRedirectingConstructor => _unsupported(); | 160 bool get isRedirectingConstructor => _unsupported(); |
| 160 bool get isFactoryConstructor => _unsupported(); | 161 bool get isFactoryConstructor => _unsupported(); |
| 161 bool operator ==(other) => _unsupported(); | 162 bool operator ==(other) => _unsupported(); |
| 162 int get hashCode => _unsupported(); | 163 int get hashCode => _unsupported(); |
| 163 } | 164 } |
| 164 | 165 |
| 165 class MethodMirrorImpl implements MethodMirror { | 166 class MethodMirrorImpl implements MethodMirror { |
| 166 final int descriptor; | 167 final int descriptor; |
| 167 final String name; | 168 final String name; |
| 168 @override | 169 @override |
| 169 final DeclarationMirror owner; | 170 final DeclarationMirror owner; |
| 170 | 171 |
| 171 const MethodMirrorImpl(this.name, this.descriptor, this.owner); | 172 const MethodMirrorImpl(this.name, this.descriptor, this.owner); |
| 172 | 173 |
| 173 int get kind => constants.kindFromEncoding(descriptor); | 174 int get kind => constants.kindFromEncoding(descriptor); |
| 174 | 175 |
| 175 @override | 176 @override |
| 176 String get constructorName => name; | 177 String get constructorName => name; |
| 177 | 178 |
| 179 // We do not support reflection on abstract methods. | |
|
eernst
2015/06/18 10:07:18
We may then support them after all.
sigurdm
2015/06/18 11:04:03
Done.
| |
| 178 @override | 180 @override |
| 179 bool get isAbstract => 0 != descriptor & constants.abstractAttribute; | 181 bool get isAbstract => false; |
|
eernst
2015/06/18 10:07:18
In case we support abstract methods, reverting thi
sigurdm
2015/06/18 11:04:03
Done.
| |
| 180 | 182 |
| 181 @override | 183 @override |
| 182 bool get isConstConstructor => 0 != descriptor & constants.constAttribute; | 184 bool get isConstConstructor => 0 != descriptor & constants.constAttribute; |
| 183 | 185 |
| 184 @override | 186 @override |
| 185 bool get isConstructor => isGenerativeConstructor || | 187 bool get isConstructor => isFactoryConstructor || isGenerativeConstructor; |
| 186 isFactoryConstructor || | |
| 187 isRedirectingConstructor; | |
| 188 | 188 |
| 189 @override | 189 @override |
| 190 bool get isFactoryConstructor => kind == constants.factoryConstructor; | 190 bool get isFactoryConstructor => kind == constants.factoryConstructor; |
| 191 | 191 |
| 192 @override | 192 @override |
| 193 bool get isGenerativeConstructor => kind == constants.generativeConstructor; | 193 bool get isGenerativeConstructor => kind == constants.generativeConstructor; |
| 194 | 194 |
| 195 @override | 195 @override |
| 196 bool get isGetter => kind == constants.getter; | 196 bool get isGetter => kind == constants.getter; |
| 197 | 197 |
| 198 @override | 198 @override |
| 199 bool get isOperator => isRegularMethod && | 199 bool get isOperator => isRegularMethod && |
| 200 ["+", "-", "*", "/", "[", "<", ">", "=", "~", "%"].contains(name[0]); | 200 ["+", "-", "*", "/", "[", "<", ">", "=", "~", "%"].contains(name[0]); |
| 201 | 201 |
| 202 @override | 202 @override |
| 203 bool get isPrivate => 0 != descriptor & constants.privateAttribute; | 203 bool get isPrivate => 0 != descriptor & constants.privateAttribute; |
| 204 | 204 |
| 205 @override | 205 @override |
| 206 bool get isRedirectingConstructor => kind == constants.redirectingConstructor; | 206 bool get isRedirectingConstructor => |
| 207 0 != descriptor & constants.redirectingConstructor; | |
| 207 | 208 |
| 208 @override | 209 @override |
| 209 bool get isRegularMethod => kind == constants.method; | 210 bool get isRegularMethod => kind == constants.method; |
| 210 | 211 |
| 211 @override | 212 @override |
| 212 bool get isSetter => kind == constants.setter; | 213 bool get isSetter => kind == constants.setter; |
| 213 | 214 |
| 214 @override | 215 @override |
| 215 bool get isStatic => 0 != descriptor & constants.staticAttribute; | 216 bool get isStatic => 0 != descriptor & constants.staticAttribute; |
| 216 | 217 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 234 | 235 |
| 235 @override | 236 @override |
| 236 String get qualifiedName => "${owner.qualifiedName}.$name"; | 237 String get qualifiedName => "${owner.qualifiedName}.$name"; |
| 237 | 238 |
| 238 // TODO(sigurdm, eernst): implement returnType | 239 // TODO(sigurdm, eernst): implement returnType |
| 239 @override | 240 @override |
| 240 TypeMirror get returnType => throw new UnimplementedError(); | 241 TypeMirror get returnType => throw new UnimplementedError(); |
| 241 | 242 |
| 242 @override | 243 @override |
| 243 String get simpleName => isConstructor | 244 String get simpleName => isConstructor |
| 244 ? (name == '' ? "$owner.simpleName" : "${owner.simpleName}.$name") | 245 ? (name == '' ? "${owner.simpleName}" : "${owner.simpleName}.$name") |
| 245 : name; | 246 : name; |
| 246 | 247 |
| 247 @override | 248 @override |
| 248 String get source => null; | 249 String get source => null; |
| 249 } | 250 } |
| 250 | 251 |
| 251 abstract class VariableMirrorUnimpl extends DeclarationMirrorUnimpl | 252 abstract class VariableMirrorUnimpl extends DeclarationMirrorUnimpl |
| 252 implements VariableMirror { | 253 implements VariableMirror { |
| 253 TypeMirror get type => _unsupported(); | 254 TypeMirror get type => _unsupported(); |
| 254 bool get isStatic => _unsupported(); | 255 bool get isStatic => _unsupported(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 265 bool get isNamed => _unsupported(); | 266 bool get isNamed => _unsupported(); |
| 266 bool get hasDefaultValue => _unsupported(); | 267 bool get hasDefaultValue => _unsupported(); |
| 267 Object get defaultValue => _unsupported(); | 268 Object get defaultValue => _unsupported(); |
| 268 } | 269 } |
| 269 | 270 |
| 270 abstract class SourceLocationUnimpl { | 271 abstract class SourceLocationUnimpl { |
| 271 int get line => _unsupported(); | 272 int get line => _unsupported(); |
| 272 int get column => _unsupported(); | 273 int get column => _unsupported(); |
| 273 Uri get sourceUri => _unsupported(); | 274 Uri get sourceUri => _unsupported(); |
| 274 } | 275 } |
| OLD | NEW |