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

Unified Diff: pkg/docgen/lib/src/models/parameter.dart

Issue 263013006: Add function parameter info in docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/docgen/lib/src/models/method.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/models/parameter.dart
diff --git a/pkg/docgen/lib/src/models/parameter.dart b/pkg/docgen/lib/src/models/parameter.dart
index 2f8798c6af7d96f3ba1522219ee16244ac49fbcb..270bf7c085124afd2e9ee8d33e098d7fd6695529 100644
--- a/pkg/docgen/lib/src/models/parameter.dart
+++ b/pkg/docgen/lib/src/models/parameter.dart
@@ -8,6 +8,7 @@ import '../exports/mirrors_util.dart' as dart2js_util;
import '../exports/source_mirrors.dart';
import 'annotation.dart';
+import 'closure.dart';
import 'doc_gen_type.dart';
import 'library.dart';
import 'mirror_based.dart';
@@ -17,7 +18,7 @@ import 'model_helpers.dart';
/// method/function parameter.
class Parameter extends MirrorBased {
final ParameterMirror mirror;
- final String name;
+ String name;
kevmoo 2014/05/06 23:05:08 Does this need to be mutable?
Emily Fortuna 2014/05/06 23:19:43 no longer. removed.
final bool isOptional;
final bool isNamed;
final bool hasDefaultValue;
@@ -25,6 +26,7 @@ class Parameter extends MirrorBased {
final String defaultValue;
/// List of the meta annotations on the parameter.
final List<Annotation> annotations;
+ final Library owningLibrary;
Parameter(ParameterMirror mirror, Library owningLibrary)
: this.mirror = mirror,
@@ -34,16 +36,24 @@ class Parameter extends MirrorBased {
hasDefaultValue = mirror.hasDefaultValue,
defaultValue = getDefaultValue(mirror),
type = new DocGenType(mirror.type, owningLibrary),
- annotations = createAnnotations(mirror, owningLibrary);
+ annotations = createAnnotations(mirror, owningLibrary),
+ owningLibrary = owningLibrary;
/// Generates a map describing the [Parameter] object.
- Map toMap() => {
- 'name': name,
- 'optional': isOptional,
- 'named': isNamed,
- 'default': hasDefaultValue,
- 'type': new List.filled(1, type.toMap()),
- 'value': defaultValue,
- 'annotations': annotations.map((a) => a.toMap()).toList()
- };
-}
+ Map toMap() {
+ var map = {
+ 'name': name,
+ 'optional': isOptional,
+ 'named': isNamed,
+ 'default': hasDefaultValue,
+ 'type': new List.filled(1, type.toMap()),
+ 'value': defaultValue,
+ 'annotations': annotations.map((a) => a.toMap()).toList()
+ };
+ if (mirror.type is FunctionTypeMirror) {
+ map['functionDeclaration'] =
+ new Closure(mirror.type as FunctionTypeMirror, owningLibrary).toMap();
+ }
+ return map;
+ }
+}
« no previous file with comments | « pkg/docgen/lib/src/models/method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698