| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 docgen.model_helpers; | 5 library docgen.model_helpers; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mi
rrors.dart' | 9 import '../exports/dart2js_mirrors.dart' as dart2js_mirrors; |
| 10 as dart2js_mirrors; | 10 import '../exports/mirrors_util.dart' as dart2js_util; |
| 11 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_ut
il.dart' | 11 import '../exports/source_mirrors.dart'; |
| 12 as dart2js_util; | 12 import '../exports/libraries.dart'; |
| 13 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/source_mir
rors.dart'; | |
| 14 import '../../../../sdk/lib/_internal/libraries.dart'; | |
| 15 | 13 |
| 16 import 'library_helpers.dart' show includePrivateMembers; | 14 import '../library_helpers.dart' show includePrivateMembers; |
| 17 import 'models.dart'; | 15 import '../package_helpers.dart'; |
| 18 import 'package_helpers.dart'; | 16 |
| 17 import 'annotation.dart'; |
| 18 import 'generic.dart'; |
| 19 import 'indexable.dart'; |
| 20 import 'library.dart'; |
| 21 import 'method.dart'; |
| 22 import 'parameter.dart'; |
| 23 import 'variable.dart'; |
| 24 |
| 25 /// Expand the method map [mapToExpand] into a more detailed map that |
| 26 /// separates out setters, getters, constructors, operators, and methods. |
| 27 Map expandMethodMap(Map<String, Method> mapToExpand) => { |
| 28 'setters': recurseMap(filterMap(mapToExpand, |
| 29 (key, val) => val.mirror.isSetter)), |
| 30 'getters': recurseMap(filterMap(mapToExpand, |
| 31 (key, val) => val.mirror.isGetter)), |
| 32 'constructors': recurseMap(filterMap(mapToExpand, |
| 33 (key, val) => val.mirror.isConstructor)), |
| 34 'operators': recurseMap(filterMap(mapToExpand, |
| 35 (key, val) => val.mirror.isOperator)), |
| 36 'methods': recurseMap(filterMap(mapToExpand, |
| 37 (key, val) => val.mirror.isRegularMethod && !val.mirror.isOperator)) |
| 38 }; |
| 19 | 39 |
| 20 String getDefaultValue(ParameterMirror mirror) { | 40 String getDefaultValue(ParameterMirror mirror) { |
| 21 if (!mirror.hasDefaultValue) return null; | 41 if (!mirror.hasDefaultValue) return null; |
| 22 return getDefaultValueFromConstMirror(mirror.defaultValue); | 42 return getDefaultValueFromConstMirror(mirror.defaultValue); |
| 23 } | 43 } |
| 24 | 44 |
| 25 String getDefaultValueFromConstMirror( | 45 String getDefaultValueFromConstMirror( |
| 26 dart2js_mirrors.Dart2JsConstantMirror valueMirror) { | 46 dart2js_mirrors.Dart2JsConstantMirror valueMirror) { |
| 27 | 47 |
| 28 if (valueMirror is dart2js_mirrors.Dart2JsStringConstantMirror) { | 48 if (valueMirror is dart2js_mirrors.Dart2JsStringConstantMirror) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // the time. | 275 // the time. |
| 256 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)]; | 276 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)]; |
| 257 if (sdkLibrary != null) { | 277 if (sdkLibrary != null) { |
| 258 return !sdkLibrary.documented; | 278 return !sdkLibrary.documented; |
| 259 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf( | 279 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf( |
| 260 mirror).contains('._')) { | 280 mirror).contains('._')) { |
| 261 return true; | 281 return true; |
| 262 } | 282 } |
| 263 return false; | 283 return false; |
| 264 } | 284 } |
| OLD | NEW |