| OLD | NEW |
| 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_util; | 5 library mirrors_util; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue, IterableBase; | 7 import 'dart:collection' show Queue, IterableBase; |
| 8 | 8 |
| 9 // TODO(rnystrom): Use "package:" URL (#4968). | 9 // TODO(rnystrom): Use "package:" URL (#4968). |
| 10 import 'mirrors.dart'; | 10 import 'mirrors.dart'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 } else if (mirror is MethodMirror) { | 34 } else if (mirror is MethodMirror) { |
| 35 MethodMirror methodMirror = mirror; | 35 MethodMirror methodMirror = mirror; |
| 36 String simpleName = methodMirror.simpleName; | 36 String simpleName = methodMirror.simpleName; |
| 37 if (methodMirror.isSetter) { | 37 if (methodMirror.isSetter) { |
| 38 // Remove trailing '='. | 38 // Remove trailing '='. |
| 39 return simpleName.substring(0, simpleName.length-1); | 39 return simpleName.substring(0, simpleName.length-1); |
| 40 } else if (methodMirror.isOperator) { | 40 } else if (methodMirror.isOperator) { |
| 41 return 'operator ${operatorName(methodMirror)}'; | 41 return 'operator ${operatorName(methodMirror)}'; |
| 42 } else if (methodMirror.isConstructor) { | 42 } else if (methodMirror.isConstructor) { |
| 43 // TODO(johnniwinther): Remove this when [simpleName] is | |
| 44 // [constructorName]. | |
| 45 simpleName = methodMirror.constructorName; | |
| 46 String className = displayName(methodMirror.owner); | 43 String className = displayName(methodMirror.owner); |
| 47 if (simpleName == '') { | 44 if (simpleName == '') { |
| 48 return className; | 45 return className; |
| 49 } else { | 46 } else { |
| 50 return '$className.$simpleName'; | 47 return '$className.$simpleName'; |
| 51 } | 48 } |
| 52 } | 49 } |
| 53 } | 50 } |
| 54 return mirror.simpleName; | 51 return mirror.simpleName; |
| 55 } | 52 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // Try type variables. | 258 // Try type variables. |
| 262 result = mirror.typeVariables.firstWhere( | 259 result = mirror.typeVariables.firstWhere( |
| 263 (TypeVariableMirror v) => v.simpleName == id, orElse: () => null); | 260 (TypeVariableMirror v) => v.simpleName == id, orElse: () => null); |
| 264 } else if (mirror is MethodMirror) { | 261 } else if (mirror is MethodMirror) { |
| 265 result = mirror.parameters.firstWhere( | 262 result = mirror.parameters.firstWhere( |
| 266 (ParameterMirror p) => p.simpleName == id, orElse: () => null); | 263 (ParameterMirror p) => p.simpleName == id, orElse: () => null); |
| 267 } | 264 } |
| 268 return result; | 265 return result; |
| 269 | 266 |
| 270 } | 267 } |
| OLD | NEW |